joined:Aug 21, 2016
I'm trying to process incoming file requests, however I need to throttle them to execute the requests one at a time (or X at a time in the future).
Each incoming file request executes a PHP script and I'd like to email the user with the file as soon as its ready.
I'm thinking about having the incoming request script append a txt document with the requested file and email address, then "alert" another script that theres something on the list.
That processing script could grab and remove the top request off the document, create the requested file, and email it to the user. After it could check the document to see if there is anything else and processing the top item, or stopping if the list is empty.
I could create a cronjob to run a script that will check the document to make sure its empty and to start a processing script (if one, or the max, isn't already running) encase there were any hiccups.
Either way I'd want to make sure the script only runs 1 or x amount of times at any given moment and that users recieve the file as soon as possible. Is there a better way of doing this?