Skip to content

Commit

Permalink
Handle cancellation while waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Nov 28, 2024
1 parent 2be41c0 commit 5e8dd80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lvmguider/actor/commands/guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ async def guide(
# Schedule the sleep as the guide task so that lvmguider stop will
# cancel it if needed.
actor.guide_task = asyncio.create_task(asyncio.sleep(sleep))
await actor.guide_task

try:
await actor.guide_task
except asyncio.CancelledError:
break

actor.status &= ~GuiderStatus.WAITING

Expand Down

0 comments on commit 5e8dd80

Please sign in to comment.