[nycphp-talk] [OT] MySQL Queue
Ben Sgro (ProjectSkyline)
ben at projectskyline.com
Tue Apr 17 10:28:36 EDT 2007
Hello Again,
I have questions about implementing a queue w/mySQL.
I was thinking the simplest way to build it would be as such:
job_queue table:
First[job_id, time][job_id+1, time+n]Last
1) Every x min, select the oldest time from the queue (LIMIT 1)
2) DELETE that row from the queue
3) Execute the job
A record is inserted into the que whever a user completes the job application wizard.
That new row contains (job_id, time( )).
Seems like a pretty simple way to build the queue. I think when I run jobs, they'll be forked off
so I can run multiple jobs. However, I have not considered how the parent process that forks
these children will watch over the jobs.
What if a job takes to long, I should prolly kill it, and reinsert it into the queue, plus keep track
of failures. We dont want to keep running a job that fails.
Any ideas?
- Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070417/082ce6eb/attachment.html>
More information about the talk
mailing list