Test Failed
Push — master ( 4a04f8...7b791b )
by Hennik
07:43
created
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 Psr\Log\LoggerInterface Logging object that impliments the PSR-3 LoggerInterface
21
-	*/
20
+	 * @var Psr\Log\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 (!$this->paused && Resque::redis()->ping() === false) {
181
-			        throw new CredisException('redis ping() failed');
182
-			    }
180
+				if (!$this->paused && 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.