Standalone ToC editor: Fix spurious error message if left open for more than two minutes

This commit is contained in:
Kovid Goyal 2022-03-21 12:30:34 +05:30
parent c81e84687d
commit b9cd42edaa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -182,11 +182,11 @@ class ToCEditAction(InterfaceAction):
else: else:
db.new_api.add_format(job['book_id'], job['fmt'], path, run_hooks=False) db.new_api.add_format(job['book_id'], job['fmt'], path, run_hooks=False)
retry_on_fail(os.remove, path) retry_on_fail(os.remove, path)
else: elif not job['started']:
if monotonic() - job['start_time'] > 120: if monotonic() - job['start_time'] > 120:
self.jobs.remove(job) self.jobs.remove(job)
error_dialog(self.gui, _('Failed to start editor'), _( error_dialog(self.gui, _('Failed to start editor'), _(
'Could not edit: {}. The Table of Contents editor did not start in four minutes').format(job['title']), show=True) 'Could not edit: {}. The Table of Contents editor did not start in two minutes').format(job['title']), show=True)
continue continue
if os.path.exists(started_path): if os.path.exists(started_path):
job['started'] = True job['started'] = True