fix: fence final worker admission against UI shutdown
This commit is contained in:
1 parent
dbc685b9a5
commit
eabf61c73b
13 files changed
+356
-46
No files matched your search
@@ -90,7 +90,7 @@ class NativeBackupSession:
|
||||
def launch_native_backup(request, *, mode='versions', target_database=None):
|
||||
from .library_lock import recheck_previous_release
|
||||
from .session_record import register_worker_session
|
||||
from .operation_queue import check_active, native_channel, task_stop
|
||||
from .operation_queue import check_active, native_channel, task_stop, commit_worker_start
|
||||
project, database = native_backup_target(request, mode=mode, target_database=target_database)
|
||||
native_backup_executable(request.mentor_bin)
|
||||
root = Path(request.evidence_dir).resolve()/('native-backup-'+uuid4().hex[:12])
|
||||
@@ -108,6 +108,7 @@ def launch_native_backup(request, *, mode='versions', target_database=None):
|
||||
'mentor_bin': request.mentor_bin, 'automatic_repair': False,
|
||||
'operation': 'native_backup', 'operation_id': root.name,
|
||||
'session_record_path': str(root/'session.json'), 'start_gate': str(root/'start-worker.signal'),
|
||||
'start_gate_protocol': 'event-v1',
|
||||
'cancel_signal': str(root/'cancel-worker.signal'), 'supervisor_pid': os.getpid(), 'desktop': None}
|
||||
job.write_text(json.dumps(record, ensure_ascii=False), 'utf-8')
|
||||
command = ([sys.executable] if getattr(sys, 'frozen', False) else
|
||||
@@ -118,7 +119,7 @@ def launch_native_backup(request, *, mode='versions', target_database=None):
|
||||
register_worker_session(process, record)
|
||||
with native_channel():
|
||||
check_active()
|
||||
Path(record['start_gate']).touch()
|
||||
commit_worker_start(process, record)
|
||||
except BaseException:
|
||||
Path(record['cancel_signal']).touch() # The unadmitted child exits without native launch.
|
||||
raise
|
||||
|
||||
Reference in new issue
Block a user