Skip to content

Commit

Permalink
Merge pull request #68 from OFFIS-DAI/fix-cancel-task-shutdown
Browse files Browse the repository at this point in the history
Moving stop to another try except, to avoid skipping cancellation of …
  • Loading branch information
jsagerOffis authored Feb 22, 2024
2 parents aaef2ab + b032fd0 commit 1abaf78
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 1abaf78

Please sign in to comment.