From 66c857d61e7714a7f79f179c3d6429ded826cc41 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 16 Jan 2020 14:24:07 -0500 Subject: [PATCH] tiny optimization which saves a little bit of memory usage for a little bit of time --- historyKeeper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/historyKeeper.js b/historyKeeper.js index 1035681d8..fe16a204c 100644 --- a/historyKeeper.js +++ b/historyKeeper.js @@ -284,9 +284,9 @@ module.exports.create = function (cfg) { const storeMessage = function (ctx, channel, msg, isCp, optionalMessageHash) { const id = channel.id; - const msgBin = Buffer.from(msg + '\n', 'utf8'); queueStorage(id, function (next) { + const msgBin = Buffer.from(msg + '\n', 'utf8'); // Store the message first, and update the index only once it's stored. // store.messageBin can be async so updating the index first may // result in a wrong cpIndex