mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Remove failures when marking them for tracking
This commit is contained in:
parent
62601d657d
commit
4a8442901d
1 changed files with 11 additions and 3 deletions
|
@ -98,9 +98,17 @@ export default class DecryptionFailureTracker {
|
|||
* @param {number} nowTs the timestamp that represents the time now.
|
||||
*/
|
||||
checkFailures(nowTs) {
|
||||
const failuresGivenGrace = this.failures.filter(
|
||||
(f) => nowTs > f.ts + DecryptionFailureTracker.GRACE_PERIOD_MS,
|
||||
);
|
||||
const failuresGivenGrace = [];
|
||||
const failuresNotReady = [];
|
||||
while (this.failures.length > 0) {
|
||||
const f = this.failures.shift();
|
||||
if (nowTs > f.ts + DecryptionFailureTracker.GRACE_PERIOD_MS) {
|
||||
failuresGivenGrace.push(f);
|
||||
} else {
|
||||
failuresNotReady.push(f);
|
||||
}
|
||||
}
|
||||
this.failures = failuresNotReady;
|
||||
|
||||
// Only track one failure per event
|
||||
const dedupedFailuresMap = failuresGivenGrace.reduce(
|
||||
|
|
Loading…
Reference in a new issue