EventIndexing: Check if there is a room when resetting the timeline.

pull/21833/head
Damir Jelić 2019-11-13 15:23:08 +01:00
parent f453fea24a
commit 1316e04776
2 changed files with 4 additions and 13 deletions

View File

@ -347,7 +347,7 @@ export default class EventIndexer {
console.log("Seshat: Stopping crawler function");
}
async addCheckpointForLimitedRoom(room) {
async onLimitedTimeline(room) {
const indexManager = PlatformPeg.get().getEventIndexingManager();
if (indexManager === null) return;
if (!MatrixClientPeg.get().isRoomEncrypted(room.roomId)) return;
@ -362,21 +362,12 @@ export default class EventIndexer {
direction: "b",
};
const forwardsCheckpoint = {
roomId: room.roomId,
token: token,
fullCrawl: false,
direction: "f",
};
console.log("Seshat: Added checkpoint because of a limited timeline",
backwardsCheckpoint, forwardsCheckpoint);
backwardsCheckpoint);
await indexManager.addCrawlerCheckpoint(backwardsCheckpoint);
await indexManager.addCrawlerCheckpoint(forwardsCheckpoint);
this.crawlerChekpoints.push(backwardsCheckpoint);
this.crawlerChekpoints.push(forwardsCheckpoint);
}
async deleteEventIndex() {

View File

@ -1310,8 +1310,8 @@ export default createReactClass({
cli.on("Room.timelineReset", async (room, timelineSet, resetAllTimelines) => {
const eventIndex = EventIndexPeg.get();
if (eventIndex === null) return;
if (resetAllTimelines === true) return;
await eventIndex.addCheckpointForLimitedRoom(room);
if (room === null) return;
await eventIndex.onLimitedTimeline(room);
});
cli.on('sync', function(state, prevState, data) {