@@ -106,51 +106,54 @@ How do the workers process the queues?
106106 8 . ` Resque_Job->fail() ` returns control to the worker (still in
107107 ` Resque_Worker::work() ` ) without a value
108108 - Job
109- 1 . The job calls ` Resque_Worker->perform() ` with the ` Resque_Job ` as
109+ 1 . ` Resque_Job_PID ` is created, registering the PID of the actual process
110+ doing the job.
111+ 2 . The job calls ` Resque_Worker->perform() ` with the ` Resque_Job ` as
110112 its only argument.
111- 2 . ` Resque_Worker->perform() ` sets up a ` try...catch ` block so it can
113+ 3 . ` Resque_Worker->perform() ` sets up a ` try...catch ` block so it can
112114 properly handle exceptions by marking jobs as failed (by calling
113115 ` Resque_Job->fail() ` , as above)
114- 3 . Inside the ` try...catch ` , ` Resque_Worker->perform() ` triggers an
116+ 4 . Inside the ` try...catch ` , ` Resque_Worker->perform() ` triggers an
115117 ` afterFork ` event
116- 4 . Still inside the ` try...catch ` , ` Resque_Worker->perform() ` calls
118+ 5 . Still inside the ` try...catch ` , ` Resque_Worker->perform() ` calls
117119 ` Resque_Job->perform() ` with no arguments
118- 5 . ` Resque_Job->perform() ` calls ` Resque_Job->getInstance() ` with no
120+ 6 . ` Resque_Job->perform() ` calls ` Resque_Job->getInstance() ` with no
119121 arguments
120- 6 . If ` Resque_Job->getInstance() ` has already been called, it returns
122+ 7 . If ` Resque_Job->getInstance() ` has already been called, it returns
121123 the existing instance; otherwise:
122- 7 . ` Resque_Job->getInstance() ` checks that the job's class (type)
124+ 8 . ` Resque_Job->getInstance() ` checks that the job's class (type)
123125 exists and has a ` perform() ` method; if not, in either case, it
124126 throws an exception which will be caught by
125127 ` Resque_Worker->perform() `
126- 8 . ` Resque_Job->getInstance() ` creates an instance of the job's class,
128+ 9 . ` Resque_Job->getInstance() ` creates an instance of the job's class,
127129 and initializes it with a reference to the ` Resque_Job ` itself, the
128130 job's arguments (which it gets by calling
129131 ` Resque_Job->getArguments() ` , which in turn simply returns the value
130132 of ` args[0] ` , or an empty array if no arguments were passed), and
131133 the queue name
132- 9 . ` Resque_Job->getInstance() ` returns control, along with the job
134+ 10 . ` Resque_Job->getInstance() ` returns control, along with the job
133135 class instance, to ` Resque_Job->perform() `
134- 10 . ` Resque_Job->perform() ` sets up its own ` try...catch ` block to
136+ 11 . ` Resque_Job->perform() ` sets up its own ` try...catch ` block to
135137 handle ` Resque_Job_DontPerform ` exceptions; any other exceptions are
136138 passed up to ` Resque_Worker->perform() `
137- 11 . ` Resque_Job->perform() ` triggers a ` beforePerform ` event
138- 12 . ` Resque_Job->perform() ` calls ` setUp() ` on the instance, if it
139+ 12 . ` Resque_Job->perform() ` triggers a ` beforePerform ` event
140+ 13 . ` Resque_Job->perform() ` calls ` setUp() ` on the instance, if it
139141 exists
140- 13 . ` Resque_Job->perform() ` calls ` perform() ` on the instance
141- 14 . ` Resque_Job->perform() ` calls ` tearDown() ` on the instance, if it
142+ 14 . ` Resque_Job->perform() ` calls ` perform() ` on the instance
143+ 15 . ` Resque_Job->perform() ` calls ` tearDown() ` on the instance, if it
142144 exists
143- 15 . ` Resque_Job->perform() ` triggers an ` afterPerform ` event
144- 16 . The ` try...catch ` block ends, suppressing ` Resque_Job_DontPerform `
145+ 16 . ` Resque_Job->perform() ` triggers an ` afterPerform ` event
146+ 17 . The ` try...catch ` block ends, suppressing ` Resque_Job_DontPerform `
145147 exceptions by returning control, and the value ` FALSE ` , to
146148 ` Resque_Worker->perform() ` ; any other situation returns the value
147149 ` TRUE ` along with control, instead
148- 17 . The ` try...catch ` block in ` Resque_Worker->perform() ` ends
149- 18 . ` Resque_Worker->perform() ` updates the job status from ` RUNNING ` to
150+ 18 . The ` try...catch ` block in ` Resque_Worker->perform() ` ends
151+ 19 . ` Resque_Worker->perform() ` updates the job status from ` RUNNING ` to
150152 ` COMPLETE ` , then returns control, with no value, to the worker
151153 (again still in ` Resque_Worker::work() ` )
152- 19 . ` Resque_Worker::work ()` calls ` exit(0) ` to terminate the job process
154+ 20 . ` Resque_Job_PID ()` is removed, the forked process will terminate soon
153155 cleanly
156+ 21 . ` Resque_Worker::work() ` calls ` exit(0) ` to terminate the job process
154157 - SPECIAL CASE: Non-forking OS (Windows)
155158 1 . Same as the job above, except it doesn't call ` exit(0) ` when done
156159 7 . ` Resque_Worker::work() ` calls ` Resque_Worker->doneWorking() ` with no
0 commit comments