@rip-lang/swarm 1.0.1 → 1.0.2
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/swarm.rip +5 -1
package/package.json
CHANGED
package/swarm.rip
CHANGED
|
@@ -266,6 +266,8 @@ export swarm = (opts = {}) ->
|
|
|
266
266
|
|
|
267
267
|
w.on 'message', (msg) ->
|
|
268
268
|
switch msg.type
|
|
269
|
+
when 'error'
|
|
270
|
+
writeFileSync('.swarm/errors.log', "worker #{slot} startup: #{msg.error}\n", { flag: 'a' }) if existsSync(_dir)
|
|
269
271
|
when 'ready'
|
|
270
272
|
dispatchNext(w, slot)
|
|
271
273
|
when 'done'
|
|
@@ -280,6 +282,7 @@ export swarm = (opts = {}) ->
|
|
|
280
282
|
when 'failed'
|
|
281
283
|
move(msg.taskPath, _died)
|
|
282
284
|
lastTask[slot] = msg.taskPath.split('/').pop()
|
|
285
|
+
writeFileSync('.swarm/errors.log', "#{msg.taskPath.split('/').pop()}: #{msg.error or 'unknown'}\n", { flag: 'a' }) if existsSync(_dir)
|
|
283
286
|
inflight[slot] = null
|
|
284
287
|
live--
|
|
285
288
|
died++
|
|
@@ -288,9 +291,10 @@ export swarm = (opts = {}) ->
|
|
|
288
291
|
dispatchNext(w, slot)
|
|
289
292
|
|
|
290
293
|
w.on 'error', (err) ->
|
|
291
|
-
|
|
294
|
+
writeFileSync('.swarm/errors.log', "worker #{slot} error: #{err.message}\n", { flag: 'a' }) if existsSync(_dir)
|
|
292
295
|
|
|
293
296
|
w.on 'exit', (code) ->
|
|
297
|
+
writeFileSync('.swarm/errors.log', "worker #{slot} exited with code #{code}, inflight: #{inflight[slot]}\n", { flag: 'a' }) if existsSync(_dir)
|
|
294
298
|
# if worker crashed mid-task, count the in-flight task as died
|
|
295
299
|
if inflight[slot]
|
|
296
300
|
move(inflight[slot], _died)
|