From 1e05af203c71e5ebc0132541e46c1963ebe982b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 24 Mar 2020 14:16:54 +0100 Subject: [PATCH] electron-main: Immediatelly set the eventIndex variable to null when closing. The react-sdk doesn't await the closing of the event index, this is done so because of limitations in the lifecycle module. This wasn't a problem since we used to just set the eventIndex variable to null. Nowadays we wait for Tantivy to shutdown using a close() method on the index. To avoid this being called multiple times while we're already closing the index set the eventIndex variable to null before awaiting. This fixes https://github.com/vector-im/riot-web/issues/12838. --- src/electron-main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/electron-main.js b/src/electron-main.js index 9c10faf..30efa4b 100644 --- a/src/electron-main.js +++ b/src/electron-main.js @@ -394,14 +394,16 @@ ipcMain.on('seshat', async function(ev, payload) { case 'closeEventIndex': if (eventIndex !== null) { + let index = eventIndex; + eventIndex = null; + try { - await eventIndex.shutdown(); + await index.shutdown(); } catch (e) { sendError(payload.id, e); return; } } - eventIndex = null; break; case 'deleteEventIndex':