From 2ef0af29e548ca9c08fca008b32cd6bd15f190b9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 23 Mar 2020 22:03:59 -0400 Subject: [PATCH] guard against index worker rpc responses for a txid with no supplied callback --- lib/hk-util.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/hk-util.js b/lib/hk-util.js index 97e5c3014..bfc9883c1 100644 --- a/lib/hk-util.js +++ b/lib/hk-util.js @@ -835,7 +835,14 @@ HK.initializeIndexWorkers = function (Env, config, _cb) { worker.on('message', function (res) { if (!res || !res.txid) { return; } //console.log(res); - response.handle(res.txid, [res.error, res.value]); + try { + response.handle(res.txid, [res.error, res.value]); + } catch (err) { + Env.Log.error("INDEX_WORKER", { + error: err, + response: res, + }); + } }); worker.on('exit', function () { var idx = workers.indexOf(worker);