mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-04 19:56:45 +02:00
Remove failures when marking them for tracking
This commit is contained in:
parent
62601d657d
commit
4a8442901d
@ -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…
x
Reference in New Issue
Block a user