@@ -91,59 +91,59 @@ |
||
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. |
@@ -24,13 +24,13 @@ |
||
24 | 24 | protected $interval = 5; |
25 | 25 | |
26 | 26 | /** |
27 | - * The primary loop for a worker. |
|
28 | - * |
|
29 | - * Every $interval (seconds), the scheduled queue will be checked for jobs |
|
30 | - * that should be pushed to Resque. |
|
31 | - * |
|
32 | - * @param int $interval How often to check schedules. |
|
33 | - */ |
|
27 | + * The primary loop for a worker. |
|
28 | + * |
|
29 | + * Every $interval (seconds), the scheduled queue will be checked for jobs |
|
30 | + * that should be pushed to Resque. |
|
31 | + * |
|
32 | + * @param int $interval How often to check schedules. |
|
33 | + */ |
|
34 | 34 | public function work($interval = null) |
35 | 35 | { |
36 | 36 | if ($interval !== null) { |