From 21a15fdcb4ec1098df2a62ea3fabea5812c7dbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 21 Nov 2019 10:38:21 +0100 Subject: [PATCH] EventIndex: Move the checkpoint loading logic into the init method. The checkpoints don't seem to be loaded anymore in the onSync method, the reason why this has stopped working is left unexplored since loading the checkpoints makes most sense during the initialization step anyways. --- src/indexing/EventIndex.js | 13 +++++-------- src/indexing/EventIndexPeg.js | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index 6bad992017..cf7e2d8da2 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -35,7 +35,12 @@ export default class EventIndex { async init() { const indexManager = PlatformPeg.get().getEventIndexingManager(); + await indexManager.initEventIndex(); + console.log("EventIndex: Successfully initialized the event index"); + + this.crawlerCheckpoints = await indexManager.loadCheckpoints(); + console.log("EventIndex: Loaded checkpoints", this.crawlerCheckpoints); this.registerListeners(); } @@ -62,14 +67,6 @@ export default class EventIndex { onSync = async (state, prevState, data) => { const indexManager = PlatformPeg.get().getEventIndexingManager(); - if (prevState === null && state === "PREPARED") { - // Load our stored checkpoints, if any. - this.crawlerCheckpoints = await indexManager.loadCheckpoints(); - console.log("EventIndex: Loaded checkpoints", - this.crawlerCheckpoints); - return; - } - if (prevState === "PREPARED" && state === "SYNCING") { const addInitialCheckpoints = async () => { const client = MatrixClientPeg.get(); diff --git a/src/indexing/EventIndexPeg.js b/src/indexing/EventIndexPeg.js index c0bdd74ff4..75f0fa66ba 100644 --- a/src/indexing/EventIndexPeg.js +++ b/src/indexing/EventIndexPeg.js @@ -55,8 +55,6 @@ class EventIndexPeg { return false; } - console.log("EventIndex: Successfully initialized the event index"); - this.index = index; return true;