mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
EventIndexPeg: Clean up the event index initialization.
This commit is contained in:
parent
c33f5ba0ca
commit
bf558b46c3
1 changed files with 15 additions and 5 deletions
|
@ -47,15 +47,25 @@ class EventIndexPeg {
|
||||||
*/
|
*/
|
||||||
async init() {
|
async init() {
|
||||||
const indexManager = PlatformPeg.get().getEventIndexingManager();
|
const indexManager = PlatformPeg.get().getEventIndexingManager();
|
||||||
console.log("Initializing event index, got {}", indexManager);
|
|
||||||
if (indexManager === null) return false;
|
if (indexManager === null) return false;
|
||||||
|
|
||||||
console.log("Seshat: Creatingnew EventIndex object", indexManager);
|
if (await indexManager.supportsEventIndexing() !== true) {
|
||||||
const index = new EventIndex();
|
console.log("EventIndex: Platform doesn't support event indexing,",
|
||||||
|
"not initializing.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = new EventIndex();
|
||||||
const userId = MatrixClientPeg.get().getUserId();
|
const userId = MatrixClientPeg.get().getUserId();
|
||||||
// TODO log errors here and return false if it errors out.
|
|
||||||
|
try {
|
||||||
await index.init(userId);
|
await index.init(userId);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("EventIndex: Error initializing the event index", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("EventIndex: Successfully initialized the event index");
|
||||||
|
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue