mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-30 09:45:53 +00:00
parent
20e04e6bff
commit
b7542fb536
1 changed files with 7 additions and 7 deletions
|
|
@ -410,12 +410,11 @@ class WorkerQueue(object):
|
|||
self._shutdown_handlers = []
|
||||
|
||||
def shutdown(self):
|
||||
if not self._queue.unfinished_tasks:
|
||||
for handler in self._shutdown_handlers:
|
||||
try:
|
||||
handler()
|
||||
except Exception:
|
||||
pass
|
||||
while self._shutdown_handlers:
|
||||
try:
|
||||
self._shutdown_handlers.pop()()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _worker(self):
|
||||
while True:
|
||||
|
|
@ -439,7 +438,6 @@ class WorkerQueue(object):
|
|||
return
|
||||
|
||||
t = click_threading.Thread(target=self._worker)
|
||||
t.daemon = True
|
||||
t.start()
|
||||
self._workers.append(t)
|
||||
|
||||
|
|
@ -452,6 +450,8 @@ class WorkerQueue(object):
|
|||
yield
|
||||
ui_worker.run()
|
||||
self._queue.join()
|
||||
for worker in self._workers:
|
||||
worker.join()
|
||||
|
||||
if self._exceptions:
|
||||
sys.exit(1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue