Code Duplication    Length = 26-26 lines in 2 locations

code/model/steps/DeploymentPipelineStep.php 1 location

@@ 221-246 (lines=26) @@
218
	 * @param string $status Resque task status
219
	 * @return boolean True if the task is finished successfully
220
	 */
221
	protected function checkResqueStatus($status) {
222
		switch($status) {
223
			case "Complete":
224
				return true;
225
			case "Failed":
226
			case "Invalid":
227
				$this->log("{$this->Title} failed with task status $status");
228
				$this->markFailed();
229
				return false;
230
			case "Queued":
231
			case "Running":
232
			default:
233
				// For running or queued tasks ensure that we have not exceeded
234
				// a reasonable time-elapsed to consider this job inactive
235
				if($this->isTimedOut()) {
236
					$this->log("{$this->Title} took longer than {$this->MaxDuration} seconds to run and has timed out");
237
					$this->markFailed();
238
					return false;
239
				} else {
240
					// While still running report no error, waiting for resque job to eventually finish
241
					// some time in the future
242
					$this->log("{$this->Title} is still in progress");
243
					return false;
244
				}
245
		}
246
	}
247
}
248

code/model/steps/RollbackStep.php 1 location

@@ 252-277 (lines=26) @@
249
	 * @param string $status Resque task status
250
	 * @return boolean True if the task is finished successfully
251
	 */
252
	protected function checkResqueStatus($status) {
253
		switch($status) {
254
			case "Complete":
255
				return true;
256
			case "Failed":
257
			case "Invalid":
258
				$this->log("{$this->Title} failed with task status $status");
259
				$this->markFailed();
260
				return false;
261
			case "Queued":
262
			case "Running":
263
			default:
264
				// For running or queued tasks ensure that we have not exceeded
265
				// a reasonable time-elapsed to consider this job inactive
266
				if($this->isTimedOut()) {
267
					$this->log("{$this->Title} took longer than {$this->MaxDuration} seconds to run and has timed out");
268
					$this->markFailed();
269
					return false;
270
				} else {
271
					// While still running report no error, waiting for resque job to eventually finish
272
					// some time in the future
273
					$this->log("{$this->Title} is still in progress");
274
					return false;
275
				}
276
		}
277
	}
278
}
279