From 873652d6855fd30f1a24d11df1cc3c2aba15b25e Mon Sep 17 00:00:00 2001 From: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com> Date: Wed, 25 Nov 2026 10:38:12 -0300 Subject: [PATCH] app: run inspection reads on a Dispatch queue, not a concurrency worker (#251) Review follow-up. The reader blocks on file I/O, and in the --smoke-inspection-order check on its gate semaphore. Inside Task.detached that blocked a Swift concurrency worker; with a single-worker cooperative pool the released newer read could not start while the older one waited, and the check timed out. The read now runs on DispatchQueue.global(qos: .userInitiated) and is bridged back with withCheckedContinuation. The request-number guard is unchanged. Signed-off-by: maridogolpeador <354308468+maridogolpeador@users.noreply.github.com> --- app/Sources/Xenora/main.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Sources/Xenora/main.swift b/app/Sources/Xenora/main.swift index 83bc36c..e720d71 100644 --- a/app/Sources/Xenora/main.swift +++ b/app/Sources/Xenora/main.swift @@ -664,7 +664,14 @@ final class InspectionModel: ObservableObject { busy = true let reader = reader Task { - let (newStatus, newReport) = await Task.detached { reader(url) }.value + // The read blocks on file I/O (and, in `--smoke-inspection-order`, on + // its gate), so it runs on a Dispatch queue instead of occupying a + // Swift concurrency worker that other tasks may need. + let (newStatus, newReport) = await withCheckedContinuation { continuation in + DispatchQueue.global(qos: .userInitiated).async { + continuation.resume(returning: reader(url)) + } + } finishedReads &+= 1 // A newer selection owns the published state, including `busy`; // an older read that finishes late is discarded.