Skip to content

Commit 32c76e9

Browse files
committed
fix issue in AMQP client with modifying dict while iterating over it
Signed-off-by: Lance-Drane <Lance-Drane@users.noreply.github.com>
1 parent c45153e commit 32c76e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/intersect_sdk_common/control_plane/brokers/amqp_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def connect(self) -> None:
159159
def disconnect(self) -> None:
160160
"""Close all connections."""
161161
self._should_disconnect = True
162-
for topic, tag_info in self._topics_to_consumer_tags.items():
162+
# make copy because the callback from basic_cancel will modify the original dict
163+
for topic, tag_info in self._topics_to_consumer_tags.copy().items():
163164
self._cancel_consumer_tag(topic, tag_info.consumer_tag)
164165

165166
# since _should_disconnect was set, _connection.ioloop.stop() will now execute after explicit connection close

0 commit comments

Comments
 (0)