From f85c02bf2099da1bb13be4968cb76473f068cc0b Mon Sep 17 00:00:00 2001 From: dkang-quora <135926539+dkang-quora@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:17:26 +0900 Subject: [PATCH] Revert "Fix leave_context_asyncio to handle cancelled asyncio task" This reverts commit 74c86b6639ca7c249eeaa4fcc95aa0509e51a3d2. --- asynq/contexts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asynq/contexts.py b/asynq/contexts.py index 828ad51..3e38871 100644 --- a/asynq/contexts.py +++ b/asynq/contexts.py @@ -93,7 +93,7 @@ def leave_context_asyncio(context): debug.write("@async: -context: %s" % debug.str(context)) task = asyncio.current_task() - getattr(task, ASYNCIO_CONTEXT_FIELD, {}).pop(id(context), None) # type: ignore + del getattr(task, ASYNCIO_CONTEXT_FIELD)[id(context)] # type: ignore def pause_contexts_asyncio(task): @@ -104,7 +104,7 @@ def pause_contexts_asyncio(task): def resume_contexts_asyncio(task): - if not getattr(task, ASYNCIO_CONTEXT_ACTIVE_FIELD, True): + if not getattr(task, ASYNCIO_CONTEXT_ACTIVE_FIELD, False): setattr(task, ASYNCIO_CONTEXT_ACTIVE_FIELD, True) for ctx in getattr(task, ASYNCIO_CONTEXT_FIELD, {}).values(): ctx.resume()