Created
February 9, 2016 16:53
-
-
Save Taluu/a6591033e71a9b92a081 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// snippet | |
class Processor | |
{ | |
public function sleep(array $options) | |
{ | |
if (null === $options['timeout']) { | |
return $this->processor instanceof SleepyInterface ? $this->processor->sleep($options) : true; | |
} | |
if ((time() - $options['reference']) <= $options['timeout']) { | |
return $this->processor instanceof SleepyInterface ? $this->processor->sleep($options) : true; | |
} | |
$this->logger->info('The process took too long. Killing the consumer...'); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment