mirror of
https://github.com/codex-storage/constantine.git
synced 2025-01-30 04:27:54 +00:00
pararun: don't swallow failures
This commit is contained in:
parent
2f6144fb7a
commit
cc47c27cca
@ -66,8 +66,10 @@ proc releaseOnProcessExit(sem: AsyncSemaphore, p: AsyncProcess) {.async.} =
|
||||
#
|
||||
# see also: https://forum.nim-lang.org/t/5565
|
||||
|
||||
var backoff = 8
|
||||
while p.running():
|
||||
await sleepAsync(10)
|
||||
backoff = min(backoff*2, 1024) # Exponential backoff
|
||||
await sleepAsync(backoff)
|
||||
sem.release()
|
||||
|
||||
proc enqueuePendingCommands(wq: WorkQueue) {.async.} =
|
||||
@ -95,6 +97,10 @@ proc flushCommandsOutput(wq: WorkQueue) {.async.} =
|
||||
break
|
||||
let charsWritten = stdout.writeBuffer(wq.lineBuf[0].addr, charsRead)
|
||||
doAssert charsRead == charsWritten
|
||||
|
||||
let exitCode = p.peekExitCode()
|
||||
if exitCode != 0:
|
||||
quit exitCode
|
||||
|
||||
if wq.cmdQueue.len == 0 and wq.outputQueue.len == 0:
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user