Created
April 15, 2020 18:44
-
-
Save DannyMor/7e5a6c99da2f53f772e3625cdee87b45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def close(self) -> None: | |
if self.quota_consumer_task and not self.quota_consumer_task.cancelled(): | |
try: | |
self.quota_consumer_task.cancel() | |
await self.quota_consumer_task | |
except asyncio.CancelledError: | |
# ignore the error here but log to inform the task was cancelled | |
pass | |
except Exception as e: | |
# log and deal with the error here | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment