Created
April 15, 2020 18:43
-
-
Save DannyMor/b7835dd2291f5ac1a5d49b3571c53276 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