ManageEventIndexDialog: Add back a control for the crawler sleep time.

This commit is contained in:
Damir Jelić 2020-01-31 18:44:52 +01:00
parent 5eb510387c
commit 01c1c2364b
4 changed files with 27 additions and 7 deletions

View file

@ -18,6 +18,7 @@ import PlatformPeg from "../PlatformPeg";
import {MatrixClientPeg} from "../MatrixClientPeg";
import {EventTimeline, RoomMember} from 'matrix-js-sdk';
import {sleep} from "../utils/promise";
import SettingsStore, {SettingLevel} from "../settings/SettingsStore";
import {EventEmitter} from "events";
/*
@ -30,7 +31,6 @@ export default class EventIndex extends EventEmitter {
// The time in ms that the crawler will wait loop iterations if there
// have not been any checkpoints to consume in the last iteration.
this._crawlerIdleTime = 5000;
this._crawlerSleepTime = 3000;
// The maximum number of events our crawler should fetch in a single
// crawl.
this._eventsPerCrawl = 100;
@ -299,10 +299,7 @@ export default class EventIndex extends EventEmitter {
let idle = false;
while (!cancelled) {
// This is a low priority task and we don't want to spam our
// homeserver with /messages requests so we set a hefty timeout
// here.
let sleepTime = this._crawlerSleepTime;
let sleepTime = SettingsStore.getValueAt(SettingLevel.DEVICE, 'crawlerSleepTime');
// Don't let the user configure a lower sleep time than 100 ms.
sleepTime = Math.max(sleepTime, 100);