@rip-lang/server 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.rip +18 -16
package/package.json
CHANGED
package/server.rip
CHANGED
|
@@ -523,24 +523,26 @@ class Manager
|
|
|
523
523
|
tracked
|
|
524
524
|
|
|
525
525
|
monitor: (w) ->
|
|
526
|
-
|
|
526
|
+
# Watch for process exit in background (don't block)
|
|
527
|
+
w.process.exited.then =>
|
|
528
|
+
return if @shuttingDown
|
|
529
|
+
return if @retiringIds.has(w.id)
|
|
527
530
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
531
|
+
# Notify server to remove dead worker's socket entry
|
|
532
|
+
try
|
|
533
|
+
ctl = getControlSocketPath(@flags.socketPrefix)
|
|
534
|
+
body = JSON.stringify({ op: 'quit', workerId: w.id })
|
|
535
|
+
fetch('http://localhost/worker', { method: 'POST', body, headers: { 'content-type': 'application/json' }, unix: ctl })
|
|
536
|
+
catch
|
|
537
|
+
null
|
|
535
538
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
@workers[idx] = @spawnWorker!() if idx >= 0
|
|
539
|
+
w.restartCount++
|
|
540
|
+
w.backoffMs = Math.min(w.backoffMs * 2, 30000)
|
|
541
|
+
return if w.restartCount > 10
|
|
542
|
+
setTimeout =>
|
|
543
|
+
idx = @workers.findIndex((x) -> x.id is w.id)
|
|
544
|
+
@workers[idx] = @spawnWorker(@currentVersion) if idx >= 0
|
|
545
|
+
, w.backoffMs
|
|
544
546
|
|
|
545
547
|
waitWorkerReady: (socketPath, timeoutMs = 5000) ->
|
|
546
548
|
start = Date.now()
|