Skip to content

Commit

Permalink
fix doctrinedriver
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbjorn committed Jan 24, 2014
1 parent 37c5625 commit 45a5057
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Bernard/Driver/DoctrineDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,16 @@ public function popMessage($queueName, $interval = 5)
try {
list($id, $message) = $this->connection->fetchArray($query, array('queue' => $queueName, 'visible' => true));

$this->connection->update('bernard_messages', array('visible' => false), compact('id'));
$this->connection->commit();
if ($id) {
$this->connection->update('bernard_messages', array('visible' => 0), compact('id'));
$this->connection->commit();

return array($message, $id);
}
} catch (\Exception $e) {
$this->connection->rollback();
}

if (isset($message) && $message) {
return array($message, $id);
}

//sleep for 10 ms
usleep(10000);
Expand Down

0 comments on commit 45a5057

Please sign in to comment.