From b4e1354e3136fa5abadf6304f9d5e4044a20071c Mon Sep 17 00:00:00 2001
From: Mateusz Charytoniuk <mateusz.charytoniuk@protonmail.com>
Date: Wed, 27 Mar 2024 13:29:59 +0100
Subject: [PATCH] fix: close swoole channel on error

---
 src/SwooleChannelIterator.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/SwooleChannelIterator.php b/src/SwooleChannelIterator.php
index 93ee3762..c2b40da3 100644
--- a/src/SwooleChannelIterator.php
+++ b/src/SwooleChannelIterator.php
@@ -64,6 +64,8 @@ readonly class SwooleChannelIterator implements IteratorAggregate
              */
             if (SWOOLE_CHANNEL_OK === $this->channel->errCode) {
                 yield new SwooleChannelIteratorChunk($data);
+            } else {
+                break;
             }
         } while (true);
     }
-- 
GitLab