Skip to content

Commit a4e3a07

Browse files
author
Chris Boulton
committed
Merge pull request #29 from salimane/upstream
fix bug whereby jobs are reserved based on an erroneous payload
2 parents 45c49cf + 68df985 commit a4e3a07

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/Resque/Job.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Resque_Job
2727
* @var object Object containing details of the job.
2828
*/
2929
public $payload;
30-
30+
3131
/**
3232
* @var object Instance of the class performing work for this job.
3333
*/
@@ -84,7 +84,7 @@ public static function create($queue, $class, $args = null, $monitor = false)
8484
public static function reserve($queue)
8585
{
8686
$payload = Resque::pop($queue);
87-
if(!$payload) {
87+
if(!is_object($payload)) {
8888
return false;
8989
}
9090

@@ -116,7 +116,7 @@ public function getStatus()
116116
$status = new Resque_Job_Status($this->payload['id']);
117117
return $status->get();
118118
}
119-
119+
120120
/**
121121
* Get the arguments supplied to this job.
122122
*
@@ -127,10 +127,10 @@ public function getArguments()
127127
if (!isset($this->payload['args'])) {
128128
return array();
129129
}
130-
130+
131131
return $this->payload['args'][0];
132132
}
133-
133+
134134
/**
135135
* Get the instantiated object for this job that will be performing work.
136136
*
@@ -171,7 +171,7 @@ public function perform()
171171
$instance = $this->getInstance();
172172
try {
173173
Resque_Event::trigger('beforePerform', $this);
174-
174+
175175
if(method_exists($instance, 'setUp')) {
176176
$instance->setUp();
177177
}
@@ -188,7 +188,7 @@ public function perform()
188188
catch(Resque_Job_DontPerform $e) {
189189
return false;
190190
}
191-
191+
192192
return true;
193193
}
194194

0 commit comments

Comments
 (0)