@@ -101,47 +101,50 @@ How do the workers process the queues?
101101        8 .  ` Resque_Job->fail() `  returns control to the worker (still in
102102           ` Resque_Worker::work() ` ) without a value
103103      *  Job
104-         1 .  The job calls ` Resque_Worker->perform() `  with the ` Resque_Job `  as its
104+         1 .  ` Resque_Job_PID `  is created, registering the PID of the actual process
105+             doing the job.
106+         2 .  The job calls ` Resque_Worker->perform() `  with the ` Resque_Job `  as its
105107           only argument.
106-         2 .  ` Resque_Worker->perform() `  sets up a ` try...catch `  block so it can
108+         3 .  ` Resque_Worker->perform() `  sets up a ` try...catch `  block so it can
107109           properly handle exceptions by marking jobs as failed (by calling
108110           ` Resque_Job->fail() ` , as above)
109-         3 .  Inside the ` try...catch ` , ` Resque_Worker->perform() `  triggers an
111+         4 .  Inside the ` try...catch ` , ` Resque_Worker->perform() `  triggers an
110112           ` afterFork `  event
111-         4 .  Still inside the ` try...catch ` , ` Resque_Worker->perform() `  calls
113+         5 .  Still inside the ` try...catch ` , ` Resque_Worker->perform() `  calls
112114           ` Resque_Job->perform() `  with no arguments
113-         5 .  ` Resque_Job->perform() `  calls ` Resque_Job->getInstance() `  with no
115+         6 .  ` Resque_Job->perform() `  calls ` Resque_Job->getInstance() `  with no
114116           arguments
115-         6 .  If ` Resque_Job->getInstance() `  has already been called, it returns the
117+         7 .  If ` Resque_Job->getInstance() `  has already been called, it returns the
116118           existing instance; otherwise:
117-         7 .  ` Resque_Job->getInstance() `  checks that the job's class (type) exists
119+         8 .  ` Resque_Job->getInstance() `  checks that the job's class (type) exists
118120           and has a ` perform() `  method; if not, in either case, it throws an
119121           exception which will be caught by ` Resque_Worker->perform() ` 
120-         8 .  ` Resque_Job->getInstance() `  creates an instance of the job's class, and
122+         9 .  ` Resque_Job->getInstance() `  creates an instance of the job's class, and
121123           initializes it with a reference to the ` Resque_Job `  itself, the job's
122124           arguments (which it gets by calling ` Resque_Job->getArguments() ` , which
123125           in turn simply returns the value of ` args[0] ` , or an empty array if no
124126           arguments were passed), and the queue name
125-         9 .  ` Resque_Job->getInstance() `  returns control, along with the job class
127+         10 .  ` Resque_Job->getInstance() `  returns control, along with the job class
126128           instance, to ` Resque_Job->perform() ` 
127-         10 .  ` Resque_Job->perform() `  sets up its own ` try...catch `  block to handle
129+         11 .  ` Resque_Job->perform() `  sets up its own ` try...catch `  block to handle
128130            ` Resque_Job_DontPerform `  exceptions; any other exceptions are passed
129131            up to ` Resque_Worker->perform() ` 
130-         11 .  ` Resque_Job->perform() `  triggers a ` beforePerform `  event
131-         12 .  ` Resque_Job->perform() `  calls ` setUp() `  on the instance, if it exists
132-         13 .  ` Resque_Job->perform() `  calls ` perform() `  on the instance
133-         14 .  ` Resque_Job->perform() `  calls ` tearDown() `  on the instance, if it
132+         12 .  ` Resque_Job->perform() `  triggers a ` beforePerform `  event
133+         13 .  ` Resque_Job->perform() `  calls ` setUp() `  on the instance, if it exists
134+         14 .  ` Resque_Job->perform() `  calls ` perform() `  on the instance
135+         15 .  ` Resque_Job->perform() `  calls ` tearDown() `  on the instance, if it
134136            exists
135-         15 .  ` Resque_Job->perform() `  triggers an ` afterPerform `  event
136-         16 .  The ` try...catch `  block ends, suppressing ` Resque_Job_DontPerform ` 
137+         16 .  ` Resque_Job->perform() `  triggers an ` afterPerform `  event
138+         17 .  The ` try...catch `  block ends, suppressing ` Resque_Job_DontPerform ` 
137139            exceptions by returning control, and the value ` FALSE ` , to
138140            ` Resque_Worker->perform() ` ; any other situation returns the value
139141            ` TRUE `  along with control, instead
140-         17 .  The ` try...catch `  block in ` Resque_Worker->perform() `  ends
141-         18 .  ` Resque_Worker->perform() `  updates the job status from ` RUNNING `  to
142+         18 .  The ` try...catch `  block in ` Resque_Worker->perform() `  ends
143+         19 .  ` Resque_Worker->perform() `  updates the job status from ` RUNNING `  to
142144            ` COMPLETE ` , then returns control, with no value, to the worker (again
143145            still in ` Resque_Worker::work() ` )
144-         19 .  ` Resque_Worker::work() `  calls ` exit(0) `  to terminate the job process
146+         20 .  ` Resque_Job_PID() `  is removed, the forked process will terminate soon
147+         21 .  ` Resque_Worker::work() `  calls ` exit(0) `  to terminate the job process
145148            cleanly
146149      *  SPECIAL CASE: Non-forking OS (Windows)
147150        1 .  Same as the job above, except it doesn't call ` exit(0) `  when done
0 commit comments