Skip to content

Commit

Permalink
Implementing pauseTube.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuswilms committed Jun 14, 2014
1 parent 0cd0e29 commit 29cc979
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Client.php
Expand Up @@ -245,6 +245,28 @@ public function useTube($tube) {
}
}

/**
* Pause a tube delaying any new job in it being reserved for a given time.
*
* @param integer $delay Number of seconds to wait before reserving any more
* jobs from the queue.
* @param string $tube A name at most 200 bytes. It specifies the tube to
* use. If the tube does not exist, it will be created.
* @return boolean `false` on error otherwise `true`.
*/
public function pauseTube($tube, $delay) {
$this->_write(sprintf('pause-tube %s %d', $tube, $delay));
$status = strtok($this->_read(), ' ');

switch ($status) {
case 'PAUSED':
return true;
default:
$this->_error($status);
return false;
}
}

/* Worker Commands */

/**
Expand Down

0 comments on commit 29cc979

Please sign in to comment.