Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The solution can be in multiple parts :</p> <ul> <li><p><strong>A script</strong> that is launched via <strong>Cron</strong> (every 5 minutes could be good, even less...). It detects the finished auction and <strong>put them in a queue</strong>.</p></li> <li><p><strong>A script</strong>, that pretty much <strong>runs continuously</strong>, and that <strong>processes items in the queue</strong>.</p></li> </ul> <p>Note that :</p> <ul> <li>You have to ensure that an auction is still open before displaying the page ! (a simple test) That way people can't join in after it closes.</li> <li>For each script, you can use PHP, or any other language</li> </ul> <p><strong>Advantages</strong> :</p> <ul> <li>The cron job is very fast, low on resources, and if there are a lot of auction to process, there is no risk it will be run in parallel (and then conflicts)</li> <li>The queue system ensure that your system won't crash because there is too much going on... It will process the queue as fast as possible, but if it is not fast enough, the website will continue to run. You can however end up with emails being sent hours or days after the auction is closed. But the "limit" is way more predictible, and won't crash your system.</li> <li>You can extend it in the future with multithreading processing of the queue, distributed processing... This is a scalable architecture.</li> <li>This architecture is fun.</li> </ul> <p><em>Additionnal informations :</em></p> <ul> <li>Regarding the daemon script, I doesn't have to run continuously. What you can do is : at the end of the cron job, if there are items in the queue, then it checks if the other script (processing) is running. If yes then exit. If the other script is not running, it launches it...</li> <li>The daemon script gets an item out of the queue and process it. At the end, if there are still items in the queue, it processes it, else, it exits.</li> <li>With this system, everything is optimal and everyone loves each other !</li> </ul> <p>To check if the other script is running, you can use a file and write in it "1" or "0" (= running / not running). The first script reads it, the second writes it... You can also use the database to do it. Or you can maybe use system tools or shell command...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload