summaryrefslogtreecommitdiff
path: root/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php
diff options
context:
space:
mode:
authorhorus_arch2017-02-20 12:42:43 +0100
committerhorus_arch2017-02-20 12:42:43 +0100
commit95c15758b50144105064d2613d1e9a9da23d4e7c (patch)
tree373eea2812fa4a7c6f58c16528e2875a208b1ada /intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php
parent3702922f4ab7f3d73f802b94d8b36571c589cb2c (diff)
downloadgospeladlershof.de-95c15758b50144105064d2613d1e9a9da23d4e7c.tar.gz
Committed vendor/ for lazyness.
Diffstat (limited to 'intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php')
-rw-r--r--intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php b/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php
new file mode 100644
index 0000000..89b9eb5
--- /dev/null
+++ b/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Command/TouchCommand.php
@@ -0,0 +1,58 @@
+<?php
+
+namespace Pheanstalk\Command;
+
+use Pheanstalk\Exception;
+use Pheanstalk\Response;
+
+/**
+ * The 'touch' command.
+ *
+ * The "touch" command allows a worker to request more time to work on a job.
+ * This is useful for jobs that potentially take a long time, but you still want
+ * the benefits of a TTR pulling a job away from an unresponsive worker. A worker
+ * may periodically tell the server that it's still alive and processing a job
+ * (e.g. it may do this on DEADLINE_SOON).
+ *
+ * @author Paul Annesley
+ * @package Pheanstalk
+ * @license http://www.opensource.org/licenses/mit-license.php
+ */
+class TouchCommand
+ extends AbstractCommand
+ implements \Pheanstalk\ResponseParser
+{
+ private $_job;
+
+ /**
+ * @param Job $job
+ */
+ public function __construct($job)
+ {
+ $this->_job = $job;
+ }
+
+ /* (non-phpdoc)
+ * @see Command::getCommandLine()
+ */
+ public function getCommandLine()
+ {
+ return sprintf('touch %u', $this->_job->getId());
+ }
+
+ /* (non-phpdoc)
+ * @see ResponseParser::parseResponse()
+ */
+ public function parseResponse($responseLine, $responseData)
+ {
+ if ($responseLine == Response::RESPONSE_NOT_FOUND) {
+ throw new Exception\ServerException(sprintf(
+ 'Job %u %s: does not exist or is not reserved by client',
+ $this->_job->getId(),
+ $responseLine
+ ));
+ }
+
+ return $this->_createResponse($responseLine);
+ }
+}