Skip to content

Commit

Permalink
worker: kill keepalive task on exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rroohhh authored and phlmn committed Dec 28, 2023
1 parent 440dbad commit 0804b17
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions worker/transcribee_worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,16 @@ async def _work():
self.keepalive(task_id, self.progress)
except Exception as exc:
logging.error("Keepliave failed", exc_info=exc)
await asyncio.sleep(seconds)
finally:
await asyncio.sleep(seconds)

task = asyncio.create_task(_work())

yield

stop_event.set()
await task
try:
yield
finally:
stop_event.set()
await task

async def run_task(self, mark_completed=True):
task = self.claim_task()
Expand Down

0 comments on commit 0804b17

Please sign in to comment.