[nycphp-talk] [OT] MySQL Queue
Ben Sgro (ProjectSkyline)
ben at projectskyline.com
Tue Apr 17 12:25:28 EDT 2007
Hello,
Good points.
So once the child finishes, it returns the status (failure || success)
to the parent. Then the parent can mark the job as completed
and remove it from the queue?
If it returns failure, we could do various error_log/debug.
We could also, increment the attempted_run counter (+1)
and if it reaches, two failed runs, we remove it from the queue
as well.
Has anyone done forking on PHP5 or have sample code?
- Ben
----- Original Message -----
From: "csnyder" <chsnyder at gmail.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Tuesday, April 17, 2007 10:38 AM
Subject: Re: [nycphp-talk] [OT] MySQL Queue
> On 4/17/07, Ben Sgro (ProjectSkyline) <ben at projectskyline.com> wrote:
>
>> 1) Every x min, select the oldest time from the queue (LIMIT 1)
>> 2) DELETE that row from the queue
>> 3) Execute the job
>
> Simple improvement would be to mark the job as "active" along with the
> pid of the process that is working on it, rather than deleting the
> record. That way if something goes wrong, you don't have to reinsert.
> Also, you can tell how many active jobs you have and decline to start
> new ones past a certain threshold.
>
> Think about what information you need for error recovery, too. After
> all, you probably only want to retry a "problem" job a certain number
> of times before giving up, notifying an admin, etc.
>
> --
> Chris Snyder
> http://chxo.com/
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
More information about the talk
mailing list