diff --git a/tractor/trionics/_mngrs.py b/tractor/trionics/_mngrs.py index 34e62a7c..cff21767 100644 --- a/tractor/trionics/_mngrs.py +++ b/tractor/trionics/_mngrs.py @@ -227,22 +227,15 @@ class _Cache: task_status: trio.TaskStatus[T] = trio.TASK_STATUS_IGNORED, ) -> None: - try: - async with mng as value: - _, no_more_users = cls.resources[ctx_key] - try: - cls.values[ctx_key] = value - task_status.started(value) - await no_more_users.wait() - finally: - value = cls.values.pop(ctx_key) - finally: - # discard nursery ref so it won't be re-used (an error)? - _rsrcs = cls.resources.pop(ctx_key) - log.error( - f'Popping ctx resources\n' - f'{_rsrcs}\n' - ) + async with mng as value: + _, no_more_users = cls.resources[ctx_key] + cls.values[ctx_key] = value + task_status.started(value) + try: + await no_more_users.wait() + finally: + value = cls.values.pop(ctx_key) + cls.resources.pop(ctx_key) class _UnresolvedCtx: