Skip to content

Commit

Permalink
Moving stop to another try except, to avoid skipping cancellation of …
Browse files Browse the repository at this point in the history
…tasks on shutdown.
  • Loading branch information
rcschrg committed Feb 21, 2024
1 parent aaef2ab commit b032fd0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mango/agent/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Every agent must live in a container. Containers are responsible for making
connections to other agents.
"""

import asyncio
import logging
from abc import ABC
Expand Down Expand Up @@ -464,7 +465,10 @@ async def shutdown(self):
self._check_inbox_task.remove_done_callback(self.raise_exceptions)
self._check_inbox_task.cancel()
await self._check_inbox_task
except asyncio.CancelledError:
pass

try:
await self._scheduler.stop()
except asyncio.CancelledError:
pass
Expand Down

0 comments on commit b032fd0

Please sign in to comment.