mirror of
https://github.com/codex-storage/constantine.git
synced 2025-02-11 18:26:22 +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
|
# see also: https://forum.nim-lang.org/t/5565
|
||||||
|
|
||||||
|
var backoff = 8
|
||||||
while p.running():
|
while p.running():
|
||||||
await sleepAsync(10)
|
backoff = min(backoff*2, 1024) # Exponential backoff
|
||||||
|
await sleepAsync(backoff)
|
||||||
sem.release()
|
sem.release()
|
||||||
|
|
||||||
proc enqueuePendingCommands(wq: WorkQueue) {.async.} =
|
proc enqueuePendingCommands(wq: WorkQueue) {.async.} =
|
||||||
@ -96,6 +98,10 @@ proc flushCommandsOutput(wq: WorkQueue) {.async.} =
|
|||||||
let charsWritten = stdout.writeBuffer(wq.lineBuf[0].addr, charsRead)
|
let charsWritten = stdout.writeBuffer(wq.lineBuf[0].addr, charsRead)
|
||||||
doAssert charsRead == charsWritten
|
doAssert charsRead == charsWritten
|
||||||
|
|
||||||
|
let exitCode = p.peekExitCode()
|
||||||
|
if exitCode != 0:
|
||||||
|
quit exitCode
|
||||||
|
|
||||||
if wq.cmdQueue.len == 0 and wq.outputQueue.len == 0:
|
if wq.cmdQueue.len == 0 and wq.outputQueue.len == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user