@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.rip +18 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/server",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Pure Rip application server — multi-worker, hot reload, HTTPS, mDNS",
5
5
  "type": "module",
6
6
  "main": "server.rip",
package/server.rip CHANGED
@@ -523,24 +523,26 @@ class Manager
523
523
  tracked
524
524
 
525
525
  monitor: (w) ->
526
- await w.process.exited # Wait for process to exit
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
- # Notify server to remove dead worker's socket entry
529
- try
530
- ctl = getControlSocketPath(@flags.socketPrefix)
531
- body = JSON.stringify({ op: 'quit', workerId: w.id })
532
- await fetch('http://localhost/worker', { method: 'POST', body, headers: { 'content-type': 'application/json' }, unix: ctl })
533
- catch
534
- null
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
- return if @shuttingDown
537
- return if @retiringIds.has(w.id)
538
- w.restartCount++
539
- w.backoffMs = Math.min(w.backoffMs * 2, 30000)
540
- return if w.restartCount > 10
541
- await new Promise (r) -> setTimeout(r, w.backoffMs)
542
- idx = @workers.findIndex((x) -> x.id is w.id)
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()