CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [ttamlrep] simultaneous exection of script on webpage: Edit Log



Zhris
Enthusiast

Dec 17, 2014, 6:55 PM


Views: 5822
Re: [ttamlrep] simultaneous exection of script on webpage

I can think of a few ways this could be implemented.

Your delete the record suggestion would work well, but I would choose to mark records perhaps as "being processed", then "processed" under a status column instead. This way you can simply select records that have a null or "unprocessed" status. I would only consider deleting or archiving records if the table became too large.

Another option would be to store a past datetime in another table or other. Select records by ascending order of date that were created after this datetime. Once your script has finished, update the datetime to the datetime of the newest record you selected, OR, after each single record has been processed, update the datetime to the datetime of that record.

Ensure you lock your script when it begins and unlock it when it ends, this will prevent manual or overlapping cron runs which otherwise may attempt to re-process records currently being processed. You may also want to consider marking those records that error-ed or took too long to complete etc etc etc perhaps a threshold number of times, they can then be analyzed, then processed manually if need be.

If you need a more detailed implementation plan, feel free to ask. I probably haven't covered all possible race conditions above.

Regards,

Chris


(This post was edited by Zhris on Dec 17, 2014, 6:57 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Dec 17, 2014, 6:57 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives