Skip to content

Commit afa40ea

Browse files
mattvonarxseratch
andauthored
Stop raising asyncio.CancelledError if the connection is already closed (#1152)
* Update async_client.py * Update slack_sdk/socket_mode/async_client.py Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
1 parent 2dee665 commit afa40ea

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

slack_sdk/socket_mode/async_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ async def process_messages(self):
122122
while not self.closed:
123123
try:
124124
await self.process_message()
125+
except asyncio.CancelledError:
126+
# if self.closed is True, the connection is already closed
127+
# In this case, we can ignore the exception here
128+
if not self.closed:
129+
raise
125130
except Exception as e:
126131
self.logger.exception(
127132
f"Failed to process a message: {e}, session: {session_id}"

0 commit comments

Comments
 (0)