Skip to content

Commit

Permalink
return on exception
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Jan 20, 2025
1 parent 1313680 commit 843f9a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libqmpbackup/qmpcommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import logging
from time import sleep
import asyncio
from qemu.qmp import EventListener
from qemu.qmp import EventListener, qmp_client
from libqmpbackup import fs


Expand Down Expand Up @@ -268,7 +268,10 @@ async def progress(self):
"""Report progress for active block job"""
while True:
sleep(1)
jobs = await self.qmp.execute("query-block-jobs")
try:
jobs = await self.qmp.execute("query-block-jobs")
except qmp_client.ExecInterruptedError:
return
if len(jobs) == 0:
return
for job in jobs:
Expand Down
1 change: 1 addition & 0 deletions qmpbackup
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ async def main():

for task in asyncio.all_tasks():
if task.get_name() == "progress" and task.done() is not True:
log.debug("Cancelling progress job")
task.cancel()
await qmp.disconnect()

Expand Down

0 comments on commit 843f9a3

Please sign in to comment.