Skip to content

Commit 777fb99

Browse files
committed
Stop worker on NAS permission denied (513) instead of burning through queue
1 parent a5226d7 commit 777fb99

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Sources/FrostscribeWorker/EncodeWorker.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ actor EncodeWorker {
108108

109109
hookRunner.fire(event: "encode_complete", title: "Encode Complete", body: job.label)
110110
} catch {
111+
let nsErr = error as NSError
112+
if nsErr.domain == NSCocoaErrorDomain && nsErr.code == 513 {
113+
log("NAS write permission denied for \(job.label) — stopping worker. Check NAS access and restart.", level: "error")
114+
hookRunner.fire(event: "nas_permission_error", title: "NAS Permission Error", body: "Worker stopped — check NAS write access.")
115+
stop()
116+
return
117+
}
111118
log("Encode failed for \(job.label): \(error)", level: "error")
112119
try? queueManager.updateStatus(id: job.id, status: .error)
113120
hookRunner.fire(event: "encode_failed", title: "Encode Failed", body: job.label)

Sources/FrostscribeWorker/RipWorker.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ actor RipWorker {
133133
hookRunner.fire(event: "rip_complete", title: "Rip Complete",
134134
body: "\(job.jobLabel) added to encode queue")
135135
} catch {
136+
let nsErr = error as NSError
137+
if nsErr.domain == NSCocoaErrorDomain && nsErr.code == 513 {
138+
log("NAS write permission denied for \(job.jobLabel) — stopping worker. Check NAS access and restart.", level: "error")
139+
hookRunner.fire(event: "nas_permission_error", title: "NAS Permission Error", body: "Worker stopped — check NAS write access.")
140+
stop()
141+
return
142+
}
136143
log("Rip failed for \(job.jobLabel): \(error)", level: "error")
137144
try? ripQueueManager.updateStatus(id: job.id, status: .error,
138145
errorMessage: error.localizedDescription)

0 commit comments

Comments
 (0)