Skip to content

Commit

Permalink
chore: revert 1b39404
Browse files Browse the repository at this point in the history
  • Loading branch information
xadahiya committed Oct 2, 2024
1 parent 9a12950 commit a5ad331
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions snapshotter/utils/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,18 +807,6 @@ def run(self) -> None:
finally:
ev_loop.close()

async def cancel_and_wait(self, task, msg=None):
task.cancel(msg)
try:
await task
except asyncio.CancelledError:
if asyncio.current_task().cancelling() == 0:
raise
else:
return # this is the only non-exceptional return
else:
raise RuntimeError('Cancelled task did not end with an exception')

async def _cleanup_tasks(self):
"""
Periodically clean up completed or timed-out tasks.
Expand All @@ -834,5 +822,5 @@ async def _cleanup_tasks(self):
self._logger.warning(
f'Task {task} timed out. Cancelling..., current_time: {current_time}, start_time: {task_start_time}',
)
await self.cancel_and_wait(task)
task.cancel()
self._active_tasks.discard((task_start_time, task))

0 comments on commit a5ad331

Please sign in to comment.