diff --git a/lib/workers/index.js b/lib/workers/index.js index c2bfb5740..d70b490e3 100644 --- a/lib/workers/index.js +++ b/lib/workers/index.js @@ -139,6 +139,9 @@ Workers.initialize = function (Env, config, _cb) { msg.txid = txid; msg.pid = PID; + // include the relevant worker process id in messages so that it will be logged + // in the event that the message times out or fails in other ways. + msg.worker = state.pid; // track which worker is doing which jobs state.tasks[txid] = msg; @@ -201,6 +204,7 @@ Workers.initialize = function (Env, config, _cb) { const state = { worker: worker, tasks: {}, + pid: worker.pid, // store the child process's id in an easily accessible location }; response.expect(txid, function (err) {