EventIndexing: Move the max events per crawl constant into the class.

pull/21833/head
Damir Jelić 2019-11-13 16:35:26 +01:00
parent 368a77ec3e
commit d4b31cb7e0
1 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,9 @@ export default class EventIndexer {
// The time that the crawler will wait between /rooms/{room_id}/messages // The time that the crawler will wait between /rooms/{room_id}/messages
// requests // requests
this._crawlerTimeout = 3000; this._crawlerTimeout = 3000;
// The maximum number of events our crawler should fetch in a single
// crawl.
this._eventsPerCrawl = 100;
this._crawlerRef = null; this._crawlerRef = null;
this.liveEventsForIndex = new Set(); this.liveEventsForIndex = new Set();
} }
@ -218,7 +221,7 @@ export default class EventIndexer {
try { try {
res = await client._createMessagesRequest( res = await client._createMessagesRequest(
checkpoint.roomId, checkpoint.token, 100, checkpoint.roomId, checkpoint.token, this._eventsPerCrawl,
checkpoint.direction); checkpoint.direction);
} catch (e) { } catch (e) {
console.log("EventIndex: Error crawling events:", e); console.log("EventIndex: Error crawling events:", e);