mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 20:17:32 +01:00
allow to inject max delay in key backup
This commit is contained in:
parent
62acd458c6
commit
9c599d53aa
@ -51,6 +51,7 @@ export class KeyBackup {
|
|||||||
private readonly keyLoader: KeyLoader,
|
private readonly keyLoader: KeyLoader,
|
||||||
private readonly storage: Storage,
|
private readonly storage: Storage,
|
||||||
private readonly platform: Platform,
|
private readonly platform: Platform,
|
||||||
|
private readonly maxDelay: number = 10000
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
get hasStopped(): boolean { return this._stopped; }
|
get hasStopped(): boolean { return this._stopped; }
|
||||||
@ -114,7 +115,7 @@ export class KeyBackup {
|
|||||||
let total = 0;
|
let total = 0;
|
||||||
let amountFinished = 0;
|
let amountFinished = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
const waitMs = this.platform.random() * 10000;
|
const waitMs = this.platform.random() * this.maxDelay;
|
||||||
const timeout = this.platform.clock.createTimeout(waitMs);
|
const timeout = this.platform.clock.createTimeout(waitMs);
|
||||||
setAbortable(timeout);
|
setAbortable(timeout);
|
||||||
await timeout.elapsed();
|
await timeout.elapsed();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user