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.
pull/21833/head
Damir Jelić 2019-11-21 10:38:21 +01:00
parent 4039d60a43
commit 21a15fdcb4
2 changed files with 5 additions and 10 deletions

View File

@ -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();

View File

@ -55,8 +55,6 @@ class EventIndexPeg {
return false;
}
console.log("EventIndex: Successfully initialized the event index");
this.index = index;
return true;