You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Remove failures when marking them for tracking
This commit is contained in:
@@ -98,9 +98,17 @@ export default class DecryptionFailureTracker {
|
|||||||
* @param {number} nowTs the timestamp that represents the time now.
|
* @param {number} nowTs the timestamp that represents the time now.
|
||||||
*/
|
*/
|
||||||
checkFailures(nowTs) {
|
checkFailures(nowTs) {
|
||||||
const failuresGivenGrace = this.failures.filter(
|
const failuresGivenGrace = [];
|
||||||
(f) => nowTs > f.ts + DecryptionFailureTracker.GRACE_PERIOD_MS,
|
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
|
// Only track one failure per event
|
||||||
const dedupedFailuresMap = failuresGivenGrace.reduce(
|
const dedupedFailuresMap = failuresGivenGrace.reduce(
|
||||||
|
|||||||
Reference in New Issue
Block a user