From 072e46635590bee7adadde0f97e9ec9ff9a44148 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 6 May 2019 14:44:34 +0200 Subject: [PATCH] [Messenger] Fix rejecting of pending messages --- .../Component/Messenger/Transport/RedisExt/Connection.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php b/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php index 6219c46a5f..66dc9fe9d6 100644 --- a/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php @@ -89,7 +89,7 @@ class Connection } catch (\RedisException $e) { } - if ($e || (false === $messages && !$this->couldHavePendingMessages)) { + if ($e || false === $messages) { throw new TransportException( ($e ? $e->getMessage() : $this->connection->getLastError()) ?? 'Could not read messages from the redis stream.' ); @@ -132,7 +132,8 @@ class Connection { $e = null; try { - $deleted = $this->connection->xdel($this->stream, [$id]); + $deleted = $this->connection->xack($this->stream, $this->group, [$id]); + $deleted = $this->connection->xdel($this->stream, [$id]) && $deleted; } catch (\RedisException $e) { }