EventIndexPanel: Get more stats for our indexer, not just the size.

This commit is contained in:
Damir Jelić 2020-01-20 17:42:24 +01:00
parent 695b8aff5b
commit 1b9b30d4ea
4 changed files with 74 additions and 24 deletions

View file

@ -425,9 +425,9 @@ export default class EventIndex {
return indexManager.searchEventIndex(searchArgs);
}
async indexSize() {
async getStats() {
const indexManager = PlatformPeg.get().getEventIndexingManager();
return indexManager.indexSize();
return indexManager.getStats();
}
currentlyCrawledRooms() {
@ -456,4 +456,27 @@ export default class EventIndex {
return {crawlingRooms, totalRooms};
}
/**
* Get the room that we are currently crawling.
*
* @returns A MatrixRoom that is being currently crawled, null if no room is
* currently being crawled.
*/
currentRoom() {
if (this._currentCheckpoint === null && this.crawlerCheckpoints.length === 0) {
console.log("EventIndex: No current nor any checkpoint");
return null;
}
const client = MatrixClientPeg.get();
if (this._currentCheckpoint !== null) {
console.log("EventIndex: Current checkpoint available");
return client.getRoom(this._currentCheckpoint.roomId);
} else {
console.log("EventIndex: No current but have checkpoint available");
return client.getRoom(this.crawlerCheckpoints[0].roomId);
}
}
}