# HG changeset patch # User Tuomo Valkonen # Date 1516480472 0 # Node ID 16a8c63344c054638b5631c875b45d7f44136a63 # Parent 0bff53095f28023b01ecb5c187d26beeac5e6f37 Fixed retry scheduling diff -r 0bff53095f28 -r 16a8c63344c0 backup.py --- 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() diff -r 0bff53095f28 -r 16a8c63344c0 instance.py --- a/instance.py Sat Jan 20 20:34:23 2018 +0000 +++ b/instance.py Sat Jan 20 20:34:32 2018 +0000 @@ -40,7 +40,10 @@ logging.info('Launching ' + str(cmd)) - self.proc=Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=None) + self.proc=Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE) + + # We don't do password input etc. + self.proc.stdin.close() def read_result(self): stream=self.proc.stdout