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>
This commit is contained in:
maridogolpeador committed 2026-11-25 10:38:12 -03:00
1 parent ae804f0530
commit 873652d685
1 file changed
+8 -1
+8 -1
View File
@@ -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.