PHP and Queue Systems? |
[eluser]ChrisMiller[/eluser]
[quote author="Aea" date="1201600393"] Random Idea : Potentially an endless loop which checks the queue database every x seconds, does its job in that way, and it will be executed on PHP server start up? Of course, there'll need to be isolation so that if something that the queue executes results in an error the queue file doesn't go down with it. A bit of an inelegant solution, would prefer to find a way to know if a script is currently running.[/quote] Same thing I was thinking about, write a controller and have it setup so it rechecks the queue and have the application go to sleep (http://us2.php.net/sleep) for 180 secs (3mins) or so and then after the sleep have it reload itself thus making a neverending loop. Now I would also add a function so you can throw a manual stop at it so you dont end up with a loop system that is hard to stop and neverending execution. Here is a quick example of a repeating class... I know its not the best but it gets the idea out... Code: <?php Now with that where you store the pending list you should have it setup with a priority list like said above thus important changes are pushed through first and non-important ones are just added to the end of the list but not forgotten. Now you say you would like to process more requests on off times then if you have php 5 then you might want to be interested in running a second looping script but instead have it run only during say 2am -> 5am then shutdown till 2am the next day using the following idea: Code: <?php |
Messages In This Thread |
PHP and Queue Systems? - by El Forum - 01-28-2008, 09:07 PM
PHP and Queue Systems? - by El Forum - 01-28-2008, 09:42 PM
PHP and Queue Systems? - by El Forum - 01-28-2008, 09:53 PM
PHP and Queue Systems? - by El Forum - 01-29-2008, 04:02 AM
PHP and Queue Systems? - by El Forum - 01-29-2008, 09:19 AM
|