|Welcome to the Monastery|
How to emulate queue for CGI script?by Gangabass (Vicar)
|on Mar 21, 2011 at 12:41 UTC||Need Help??|
Gangabass has asked for the
wisdom of the Perl Monks concerning the following question:
In my CGI script i make long (up to 10 seconds) request to another server, parsing results and show response to my user (via AJAX). But another server owner ask me to perform each request no more than 1 request per 10 seconds so:
First i think about Cron which will open simple text file (queue file), read first line and send it as a request to another server. After that it will save result in another file (where i'll cache all results). So my CGI will first check cache file and try to find result in it and after that (if result is not finded) it will save task in the queue file (for the Cron).
But Cron run only once per minute so my user must wait for so long time...
So how i can do this via CGI?
May be some module already written for such tasks?