Passed
Push — develop ( 25ff30...23fbc2 )
by Hennik
01:03 queued 10s
created
demo/job.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 {
4 4
 	public function perform()
5 5
 	{
6
-        fwrite(STDOUT, 'Start job! -> ');
6
+		fwrite(STDOUT, 'Start job! -> ');
7 7
 		sleep(1);
8 8
 		fwrite(STDOUT, 'Job ended!' . PHP_EOL);
9 9
 	}
Please login to merge, or discard this patch.
demo/queue.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 if (empty($argv[2])) {
21 21
 	$jobId = Resque::enqueue('default', $argv[1], $args, true);
22 22
 } else {
23
-        $jobId = Resque::enqueue($argv[1], $argv[2], $args, true);	
23
+		$jobId = Resque::enqueue($argv[1], $argv[2], $args, true);	
24 24
 }
25 25
 
26 26
 echo "Queued job ".$jobId."\n\n";
Please login to merge, or discard this patch.
lib/Resque/Job.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 			return $this->instance;
170 170
 		}
171 171
 
172
-        $this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue);
173
-        $this->instance->job = $this;
174
-        return $this->instance;
172
+		$this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue);
173
+		$this->instance->job = $this;
174
+		return $this->instance;
175 175
 	}
176 176
 
177 177
 	/**
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 		return $this;
277 277
 	}
278 278
 
279
-    /**
280
-     * @return Resque_Job_FactoryInterface
281
-     */
282
-    public function getJobFactory()
283
-    {
284
-        if ($this->jobFactory === null) {
285
-            $this->jobFactory = new Resque_Job_Factory();
286
-        }
287
-        return $this->jobFactory;
288
-    }
279
+	/**
280
+	 * @return Resque_Job_FactoryInterface
281
+	 */
282
+	public function getJobFactory()
283
+	{
284
+		if ($this->jobFactory === null) {
285
+			$this->jobFactory = new Resque_Job_Factory();
286
+		}
287
+		return $this->jobFactory;
288
+	}
289 289
 }
Please login to merge, or discard this patch.
lib/Resque/Job/Factory.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -3,30 +3,30 @@
 block discarded – undo
3 3
 class Resque_Job_Factory implements Resque_Job_FactoryInterface
4 4
 {
5 5
 
6
-    /**
7
-     * @param $className
8
-     * @param array $args
9
-     * @param $queue
10
-     * @return Resque_JobInterface
11
-     * @throws \Resque_Exception
12
-     */
13
-    public function create($className, $args, $queue)
14
-    {
15
-        if (!class_exists($className)) {
16
-            throw new Resque_Exception(
17
-                'Could not find job class ' . $className . '.'
18
-            );
19
-        }
6
+	/**
7
+	 * @param $className
8
+	 * @param array $args
9
+	 * @param $queue
10
+	 * @return Resque_JobInterface
11
+	 * @throws \Resque_Exception
12
+	 */
13
+	public function create($className, $args, $queue)
14
+	{
15
+		if (!class_exists($className)) {
16
+			throw new Resque_Exception(
17
+				'Could not find job class ' . $className . '.'
18
+			);
19
+		}
20 20
 
21
-        if (!method_exists($className, 'perform')) {
22
-            throw new Resque_Exception(
23
-                'Job class ' . $className . ' does not contain a perform method.'
24
-            );
25
-        }
21
+		if (!method_exists($className, 'perform')) {
22
+			throw new Resque_Exception(
23
+				'Job class ' . $className . ' does not contain a perform method.'
24
+			);
25
+		}
26 26
 
27
-        $instance = new $className;
28
-        $instance->args = $args;
29
-        $instance->queue = $queue;
30
-        return $instance;
31
-    }
27
+		$instance = new $className;
28
+		$instance->args = $args;
29
+		$instance->queue = $queue;
30
+		return $instance;
31
+	}
32 32
 }
Please login to merge, or discard this patch.
lib/Resque.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 {
11 11
 	const VERSION = '1.2';
12 12
 
13
-    const DEFAULT_INTERVAL = 5;
13
+	const DEFAULT_INTERVAL = 5;
14 14
 
15 15
 	/**
16 16
 	 * @var Resque_Redis Instance of Resque_Redis that talks to redis.
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	protected static $redisDatabase = 0;
30 30
 
31
-    /**
32
-     * @var string auth of Redis database
33
-     */
31
+	/**
32
+	 * @var string auth of Redis database
33
+	 */
34 34
 	protected static $auth;
35 35
 
36 36
 	/**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *                      and returns a Resque_Redis instance, or
43 43
 	 *                      a nested array of servers with host/port pairs.
44 44
 	 * @param int $database
45
-     * @param string $auth
45
+	 * @param string $auth
46 46
 	 */
47 47
 	public static function setBackend($server, $database = 0, $auth = null)
48 48
 	{
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 
72 72
 		if (!empty(self::$auth)) {
73
-            self::$redis->auth(self::$auth);
74
-        }
73
+			self::$redis->auth(self::$auth);
74
+		}
75 75
 
76 76
 		return self::$redis;
77 77
 	}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public static function pop($queue)
135 135
 	{
136
-        $item = self::redis()->lpop('queue:' . $queue);
136
+		$item = self::redis()->lpop('queue:' . $queue);
137 137
 
138 138
 		if(!$item) {
139 139
 			return;
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public static function dequeue($queue, $items = Array())
153 153
 	{
154
-	    if(count($items) > 0) {
154
+		if(count($items) > 0) {
155 155
 			return self::removeItems($queue, $items);
156
-	    } else {
156
+		} else {
157 157
 			return self::removeList($queue);
158
-	    }
158
+		}
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public static function removeQueue($queue)
168 168
 	{
169
-	    $num = self::removeList($queue);
170
-	    self::redis()->srem('queues', $queue);
171
-	    return $num;
169
+		$num = self::removeList($queue);
170
+		self::redis()->srem('queues', $queue);
171
+		return $num;
172 172
 	}
173 173
 
174 174
 	/**
@@ -181,28 +181,28 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public static function blpop(array $queues, $timeout)
183 183
 	{
184
-	    $list = array();
185
-	    foreach($queues AS $queue) {
184
+		$list = array();
185
+		foreach($queues AS $queue) {
186 186
 		$list[] = 'queue:' . $queue;
187
-	    }
187
+		}
188 188
 
189
-	    $item = self::redis()->blpop($list, (int)$timeout);
189
+		$item = self::redis()->blpop($list, (int)$timeout);
190 190
 
191
-	    if(!$item) {
191
+		if(!$item) {
192 192
 		return;
193
-	    }
193
+		}
194 194
 
195
-	    /**
196
-	     * Normally the Resque_Redis class returns queue names without the prefix
197
-	     * But the blpop is a bit different. It returns the name as prefix:queue:name
198
-	     * So we need to strip off the prefix:queue: part
199
-	     */
200
-	    $queue = substr($item[0], strlen(self::redis()->getPrefix() . 'queue:'));
195
+		/**
196
+		 * Normally the Resque_Redis class returns queue names without the prefix
197
+		 * But the blpop is a bit different. It returns the name as prefix:queue:name
198
+		 * So we need to strip off the prefix:queue: part
199
+		 */
200
+		$queue = substr($item[0], strlen(self::redis()->getPrefix() . 'queue:'));
201 201
 
202
-	    return array(
202
+		return array(
203 203
 		'queue'   => $queue,
204 204
 		'payload' => json_decode($item[1], true)
205
-	    );
205
+		);
206 206
 	}
207 207
 
208 208
 	/**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		while (!$finished) {
331 331
 			$string = self::redis()->rpoplpush($requeueQueue, self::redis()->getPrefix() .$originalQueue);
332 332
 			if (empty($string)) {
333
-			    $finished = true;
333
+				$finished = true;
334 334
 			}
335 335
 		}
336 336
 
@@ -353,29 +353,29 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	private static function matchItem($string, $items)
355 355
 	{
356
-	    $decoded = json_decode($string, true);
356
+		$decoded = json_decode($string, true);
357 357
 
358
-	    foreach($items as $key => $val) {
358
+		foreach($items as $key => $val) {
359 359
 			# class name only  ex: item[0] = ['class']
360 360
 			if (is_numeric($key)) {
361
-			    if($decoded['class'] == $val) {
361
+				if($decoded['class'] == $val) {
362 362
 					return true;
363
-			    }
363
+				}
364 364
 			# class name with args , example: item[0] = ['class' => {'foo' => 1, 'bar' => 2}]
365 365
 			} elseif (is_array($val)) {
366
-			    $decodedArgs = (array)$decoded['args'][0];
367
-			    if ($decoded['class'] == $key &&
366
+				$decodedArgs = (array)$decoded['args'][0];
367
+				if ($decoded['class'] == $key &&
368 368
 					count($decodedArgs) > 0 && count(array_diff($decodedArgs, $val)) == 0) {
369 369
 					return true;
370 370
 				}
371 371
 			# class name with ID, example: item[0] = ['class' => 'id']
372 372
 			} else {
373
-			    if ($decoded['class'] == $key && $decoded['id'] == $val) {
373
+				if ($decoded['class'] == $key && $decoded['id'] == $val) {
374 374
 					return true;
375
-			    }
375
+				}
376 376
 			}
377
-	    }
378
-	    return false;
377
+		}
378
+		return false;
379 379
 	}
380 380
 
381 381
 	/**
@@ -388,9 +388,9 @@  discard block
 block discarded – undo
388 388
 	 */
389 389
 	private static function removeList($queue)
390 390
 	{
391
-	    $counter = self::size($queue);
392
-	    $result = self::redis()->del('queue:' . $queue);
393
-	    return ($result == 1) ? $counter : 0;
391
+		$counter = self::size($queue);
392
+		$result = self::redis()->del('queue:' . $queue);
393
+		return ($result == 1) ? $counter : 0;
394 394
 	}
395 395
 
396 396
 	/*
Please login to merge, or discard this patch.
lib/Resque/Worker.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 	private static $processPrefix = 'resque';
18 18
 
19 19
 	/**
20
-	* @var LoggerInterface Logging object that impliments the PSR-3 LoggerInterface
21
-	*/
20
+	 * @var LoggerInterface Logging object that impliments the PSR-3 LoggerInterface
21
+	 */
22 22
 	public $logger;
23 23
 
24 24
 	/**
@@ -61,30 +61,30 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	private $child = null;
63 63
 
64
-    /**
65
-     * Instantiate a new worker, given a list of queues that it should be working
66
-     * on. The list of queues should be supplied in the priority that they should
67
-     * be checked for jobs (first come, first served)
68
-     *
69
-     * Passing a single '*' allows the worker to work on all queues in alphabetical
70
-     * order. You can easily add new queues dynamically and have them worked on using
71
-     * this method.
72
-     *
73
-     * @param string|array $queues String with a single queue name, array with multiple.
74
-     */
75
-    public function __construct($queues)
76
-    {
77
-        $this->logger = new Resque_Log();
64
+	/**
65
+	 * Instantiate a new worker, given a list of queues that it should be working
66
+	 * on. The list of queues should be supplied in the priority that they should
67
+	 * be checked for jobs (first come, first served)
68
+	 *
69
+	 * Passing a single '*' allows the worker to work on all queues in alphabetical
70
+	 * order. You can easily add new queues dynamically and have them worked on using
71
+	 * this method.
72
+	 *
73
+	 * @param string|array $queues String with a single queue name, array with multiple.
74
+	 */
75
+	public function __construct($queues)
76
+	{
77
+		$this->logger = new Resque_Log();
78 78
 
79
-        if(!is_array($queues)) {
80
-            $queues = array($queues);
81
-        }
79
+		if(!is_array($queues)) {
80
+			$queues = array($queues);
81
+		}
82 82
 
83
-        $this->queues = $queues;
84
-        $this->hostname = php_uname('n');
83
+		$this->queues = $queues;
84
+		$this->hostname = php_uname('n');
85 85
 
86
-        $this->id = $this->hostname . ':'.getmypid() . ':' . implode(',', $this->queues);
87
-    }
86
+		$this->id = $this->hostname . ':'.getmypid() . ':' . implode(',', $this->queues);
87
+	}
88 88
 
89 89
 	/**
90 90
 	 * Set the process prefix of the workers to the given prefix string.
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 		$this->updateProcLine('Starting');
167 167
 		$this->startup();
168 168
 
169
-        if(function_exists('pcntl_signal_dispatch')) {
170
-            pcntl_signal_dispatch();
171
-        }
169
+		if(function_exists('pcntl_signal_dispatch')) {
170
+			pcntl_signal_dispatch();
171
+		}
172 172
 
173 173
 		while(true) {
174 174
 			if($this->shutdown) {
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 
178 178
 			// is redis still alive?
179 179
 			try {
180
-			    if (Resque::redis()->ping() === false) {
181
-			        throw new CredisException('redis ping() failed');
182
-			    }
180
+				if (Resque::redis()->ping() === false) {
181
+					throw new CredisException('redis ping() failed');
182
+				}
183 183
 			} catch (CredisException $e) {
184
-			    $this->logger->log(Psr\Log\LogLevel::ERROR, 'redis went away. trying to reconnect');
185
-			    Resque::$redis = null;
186
-			    usleep($interval * 1000000);
187
-			    continue;
184
+				$this->logger->log(Psr\Log\LogLevel::ERROR, 'redis went away. trying to reconnect');
185
+				Resque::$redis = null;
186
+				usleep($interval * 1000000);
187
+				continue;
188 188
 			}
189 189
 
190 190
 			// Attempt to find and reserve a job
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 				// Wait until the child process finishes before continuing
260 260
 				while (pcntl_wait($status, WNOHANG) === 0) {
261 261
 					if(function_exists('pcntl_signal_dispatch')) {
262
-			            pcntl_signal_dispatch();
263
-			        }
262
+						pcntl_signal_dispatch();
263
+					}
264 264
 
265 265
 					// Pause for a half a second to conserve system resources
266 266
 					usleep(500000);
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 
338 338
 		if($blocking === true) {
339
-		    if(empty($queues)){
340
-                $this->logger->log(Psr\Log\LogLevel::INFO, 'No queue was found, sleeping for {interval}', array('interval' => $timeout));
341
-                usleep($timeout * 1000000);
342
-                return false;
343
-            }
339
+			if(empty($queues)){
340
+				$this->logger->log(Psr\Log\LogLevel::INFO, 'No queue was found, sleeping for {interval}', array('interval' => $timeout));
341
+				usleep($timeout * 1000000);
342
+				return false;
343
+			}
344 344
 			$job = Resque_Job::reserveBlocking($queues, $timeout);
345 345
 			if($job) {
346 346
 				$this->logger->log(Psr\Log\LogLevel::INFO, 'Found job on {queue}', array('queue' => $job->queue));
Please login to merge, or discard this patch.
lib/Resque/Job/Status.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 	const STATUS_COMPLETE = 4;
15 15
 
16 16
 	/**
17
- 	 * @var string The prefix of the job status id.
18
- 	 */
17
+	 * @var string The prefix of the job status id.
18
+	 */
19 19
  	private $prefix;
20 20
 
21 21
 	/**
@@ -143,33 +143,33 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 
145 145
 	/**
146
- 	 * Fetch the last update timestamp of the job being monitored.
147
- 	 *
148
- 	 * @return mixed False if the job is not being monitored, otherwise the
146
+	 * Fetch the last update timestamp of the job being monitored.
147
+	 *
148
+	 * @return mixed False if the job is not being monitored, otherwise the
149 149
 	 *  update timestamp.
150
- 	 */
150
+	 */
151 151
 	public function updated()
152 152
 	{
153 153
 		return $this->fetch('updated');
154 154
  	}
155 155
 
156 156
 	/**
157
- 	 * Fetch the start timestamp of the job being monitored.
158
- 	 *
159
- 	 * @return mixed False if the job is not being monitored, otherwise the
157
+	 * Fetch the start timestamp of the job being monitored.
158
+	 *
159
+	 * @return mixed False if the job is not being monitored, otherwise the
160 160
 	 *  start timestamp.
161
- 	 */
161
+	 */
162 162
 	public function started()
163 163
 	{
164 164
 		return $this->fetch('started');
165 165
  	}
166 166
 
167 167
 	/**
168
- 	 * Fetch the result of the job being monitored.
169
- 	 *
170
- 	 * @return mixed False if the job is not being monitored, otherwise the result
171
- 	 * 	as mixed
172
- 	 */
168
+	 * Fetch the result of the job being monitored.
169
+	 *
170
+	 * @return mixed False if the job is not being monitored, otherwise the result
171
+	 * 	as mixed
172
+	 */
173 173
 	public function result()
174 174
 	{
175 175
 		return $this->fetch('result');
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	}
195 195
 
196 196
 	/**
197
-	* Fetch a value from the status packet for the job being monitored.
198
-	*
199
-	* @return mixed False if the status is not being monitored, otherwise the
200
-	*  requested value from the status packet.
201
-	*/
197
+	 * Fetch a value from the status packet for the job being monitored.
198
+	 *
199
+	 * @return mixed False if the status is not being monitored, otherwise the
200
+	 *  requested value from the status packet.
201
+	 */
202 202
 	protected function fetch($value = null)
203 203
 	{
204 204
 		if(!$this->isTracking()) {
Please login to merge, or discard this patch.
lib/Resque/Redis.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public static function prefix($namespace)
100 100
 	{
101
-	    if (substr($namespace, -1) !== ':' && $namespace != '') {
102
-	        $namespace .= ':';
103
-	    }
104
-	    self::$defaultNamespace = $namespace;
101
+		if (substr($namespace, -1) !== ':' && $namespace != '') {
102
+			$namespace .= ':';
103
+		}
104
+		self::$defaultNamespace = $namespace;
105 105
 	}
106 106
 
107 107
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *                      DSN-supplied value will be used instead and this parameter is ignored.
111 111
 	 * @param object $client Optional Credis_Cluster or Credis_Client instance instantiated by you
112 112
 	 */
113
-    public function __construct($server, $database = null, $client = null)
113
+	public function __construct($server, $database = null, $client = null)
114 114
 	{
115 115
 		try {
116 116
 			if (is_object($client)) {
@@ -258,16 +258,16 @@  discard block
 block discarded – undo
258 258
 
259 259
 	public static function getPrefix()
260 260
 	{
261
-	    return self::$defaultNamespace;
261
+		return self::$defaultNamespace;
262 262
 	}
263 263
 
264 264
 	public static function removePrefix($string)
265 265
 	{
266
-	    $prefix=self::getPrefix();
266
+		$prefix=self::getPrefix();
267 267
 
268
-	    if (substr($string, 0, strlen($prefix)) == $prefix) {
269
-	        $string = substr($string, strlen($prefix), strlen($string) );
270
-	    }
271
-	    return $string;
268
+		if (substr($string, 0, strlen($prefix)) == $prefix) {
269
+			$string = substr($string, strlen($prefix), strlen($string) );
270
+		}
271
+		return $string;
272 272
 	}
273 273
 }
Please login to merge, or discard this patch.
lib/ResqueScheduler.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -91,59 +91,59 @@
 block discarded – undo
91 91
 		return Resque::redis()->llen('delayed:' . $timestamp, $timestamp);
92 92
 	}
93 93
 
94
-    /**
95
-     * Remove a delayed job from the queue
96
-     *
97
-     * note: you must specify exactly the same
98
-     * queue, class and arguments that you used when you added
99
-     * to the delayed queue
100
-     *
101
-     * also, this is an expensive operation because all delayed keys have tobe
102
-     * searched
103
-     *
104
-     * @param $queue
105
-     * @param $class
106
-     * @param $args
107
-     * @return int number of jobs that were removed
108
-     */
109
-    public static function removeDelayed($queue, $class, $args)
110
-    {
111
-       $destroyed=0;
112
-       $item=json_encode(self::jobToHash($queue, $class, $args));
113
-       $redis=Resque::redis();
94
+	/**
95
+	 * Remove a delayed job from the queue
96
+	 *
97
+	 * note: you must specify exactly the same
98
+	 * queue, class and arguments that you used when you added
99
+	 * to the delayed queue
100
+	 *
101
+	 * also, this is an expensive operation because all delayed keys have tobe
102
+	 * searched
103
+	 *
104
+	 * @param $queue
105
+	 * @param $class
106
+	 * @param $args
107
+	 * @return int number of jobs that were removed
108
+	 */
109
+	public static function removeDelayed($queue, $class, $args)
110
+	{
111
+	   $destroyed=0;
112
+	   $item=json_encode(self::jobToHash($queue, $class, $args));
113
+	   $redis=Resque::redis();
114 114
 
115
-       foreach($redis->keys('delayed:*') as $key)
116
-       {
117
-           $key=$redis->removePrefix($key);
118
-           $destroyed+=$redis->lrem($key,0,$item);
119
-       }
115
+	   foreach($redis->keys('delayed:*') as $key)
116
+	   {
117
+		   $key=$redis->removePrefix($key);
118
+		   $destroyed+=$redis->lrem($key,0,$item);
119
+	   }
120 120
 
121
-       return $destroyed;
122
-    }
121
+	   return $destroyed;
122
+	}
123 123
 
124
-    /**
125
-     * removed a delayed job queued for a specific timestamp
126
-     *
127
-     * note: you must specify exactly the same
128
-     * queue, class and arguments that you used when you added
129
-     * to the delayed queue
130
-     *
131
-     * @param $timestamp
132
-     * @param $queue
133
-     * @param $class
134
-     * @param $args
135
-     * @return mixed
136
-     */
137
-    public static function removeDelayedJobFromTimestamp($timestamp, $queue, $class, $args)
138
-    {
139
-        $key = 'delayed:' . self::getTimestamp($timestamp);
140
-        $item = json_encode(self::jobToHash($queue, $class, $args));
141
-        $redis = Resque::redis();
142
-        $count = $redis->lrem($key, 0, $item);
143
-        self::cleanupTimestamp($key, $timestamp);
124
+	/**
125
+	 * removed a delayed job queued for a specific timestamp
126
+	 *
127
+	 * note: you must specify exactly the same
128
+	 * queue, class and arguments that you used when you added
129
+	 * to the delayed queue
130
+	 *
131
+	 * @param $timestamp
132
+	 * @param $queue
133
+	 * @param $class
134
+	 * @param $args
135
+	 * @return mixed
136
+	 */
137
+	public static function removeDelayedJobFromTimestamp($timestamp, $queue, $class, $args)
138
+	{
139
+		$key = 'delayed:' . self::getTimestamp($timestamp);
140
+		$item = json_encode(self::jobToHash($queue, $class, $args));
141
+		$redis = Resque::redis();
142
+		$count = $redis->lrem($key, 0, $item);
143
+		self::cleanupTimestamp($key, $timestamp);
144 144
 
145
-        return $count;
146
-    }
145
+		return $count;
146
+	}
147 147
 	
148 148
 	/**
149 149
 	 * Generate hash of all job properties to be saved in the scheduled queue.
Please login to merge, or discard this patch.