fix: preserve native reads and advancing metadata operations

This commit is contained in:
阿白叔 committed 2026-11-17 00:39:30 +08:00
1 parent 5b7e7bea2f
commit 07206ce0d1
5 files changed
+128 -8

No files matched your search

+11 -7
View File
@@ -244,13 +244,17 @@ class NativeManagementAdapter:
worker.bind_cancellation(job['cancel_signal'])
if hasattr(worker, 'bind_session'):
worker.bind_session(job)
from .operation_queue import commit_worker_start
commit_worker_start(worker, job)
while worker.poll() is None and time.monotonic() < deadline:
if self.stop is not None and self.stop.is_set():
Path(job['cancel_signal']).touch()
break
time.sleep(.1)
from contextlib import nullcontext
from .operation_queue import commit_worker_start, native_channel
# Only admitted native waiting outlives the UI's metadata deadline.
channel = native_channel(read_only=True) if job.get('worker_role') == 'catalog_readonly' else nullcontext()
with channel:
commit_worker_start(worker, job)
while worker.poll() is None and time.monotonic() < deadline:
if self.stop is not None and self.stop.is_set():
Path(job['cancel_signal']).touch()
break
time.sleep(.1)
if worker.poll() is None:
# DesktopWorker.close() requests a kill without a cancellation file.
# Keep this exact worker alive until its native call returns normally.