Skip to content

Commit

Permalink
[BUGFIX] Set message state to "DONE" after finish() was called
Browse files Browse the repository at this point in the history
- Sets message state to Message::STATE_DONE when RedisQueue::finish() has
  been executed successfully
- Minor cosmetic fix
  • Loading branch information
bwaidelich committed Apr 11, 2012
1 parent 09b8a35 commit a445929
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Classes/Queue/RedisQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct($name, array $options = array()) {
$this->defaultTimeout = (integer)$options['defaultTimeout'];
}
$clientOptions = isset($options['client']) ? $options['client'] : array();
$this->client = new \Predis\Client($options['client']);
$this->client = new \Predis\Client($clientOptions);
}

/**
Expand Down Expand Up @@ -119,7 +119,11 @@ public function waitAndReserve($timeout = NULL) {
*/
public function finish(\TYPO3\Jobqueue\Common\Queue\Message $message) {
$originalValue = $message->getOriginalValue();
return $this->client->lrem("queue:{$this->name}:processing", 0, $originalValue) > 0;
$success = $this->client->lrem("queue:{$this->name}:processing", 0, $originalValue) > 0;
if ($success) {
$message->setState(\TYPO3\Jobqueue\Common\Queue\Message::STATE_DONE);
}
return $success;
}

/**
Expand Down

0 comments on commit a445929

Please sign in to comment.