--- a/backup.py Sat Jan 20 20:34:23 2018 +0000 +++ b/backup.py Sat Jan 20 20:34:32 2018 +0000 @@ -141,11 +141,6 @@ logging.debug('Borg subprocess terminated; terminating log listener thread') - with self.lock: - self.thread_log=None - self.__finish_and_reschedule_if_both_listeners_terminated() - - def __result_listener(self): with self.lock: status, callback=self.__status_unlocked() @@ -169,23 +164,21 @@ logging.debug('Borg subprocess terminated (success: %s); terminating result listener thread' % str(success)) + self.thread_log.join() + with self.lock: if self.current_operation['operation']=='create': self.lastrun=self.current_operation['when_monotonic'] self.lastrun_success=success self.thread_res=None - self.__finish_and_reschedule_if_both_listeners_terminated() + self.thread_log=None + self.borg_instance=None + self.current_operation=None + self.__schedule_unlocked() status, callback=self.__status_unlocked() if callback: callback(self, status) - def __finish_and_reschedule_if_both_listeners_terminated(self): - if self.thread_res==None and self.thread_log==None: - logging.debug('Both threads terminated') - self.borg_instance=None - self.current_operation=None - self.__schedule_unlocked() - def __do_launch(self, queue, op, archive_or_repository, *args): inst=BorgInstance(op['operation'], archive_or_repository, *args) inst.launch()