Skip to content

Commit

Permalink
Revert "Fix leave_context_asyncio to handle cancelled asyncio task"
Browse files Browse the repository at this point in the history
This reverts commit 74c86b6.
  • Loading branch information
dkang-quora authored Apr 18, 2024
1 parent bf350a7 commit f85c02b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions asynq/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit f85c02b

Please sign in to comment.