Don't hash the eventId (it's uneccessary)
This commit is contained in:
parent
c5252be4a8
commit
98ed93ee5b
1 changed files with 3 additions and 7 deletions
|
@ -21,10 +21,6 @@ class DecryptionFailure {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventIdHash(eventId) {
|
|
||||||
return crypto.subtle.digest('SHA-256', eventId);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class DecryptionFailureTracker {
|
export default class DecryptionFailureTracker {
|
||||||
// Array of items of type DecryptionFailure. Every `CHECK_INTERVAL_MS`, this list
|
// Array of items of type DecryptionFailure. Every `CHECK_INTERVAL_MS`, this list
|
||||||
// is checked for failures that happened > `GRACE_PERIOD_MS` ago. Those that did
|
// is checked for failures that happened > `GRACE_PERIOD_MS` ago. Those that did
|
||||||
|
@ -37,7 +33,7 @@ export default class DecryptionFailureTracker {
|
||||||
|
|
||||||
// Event IDs of failures that were tracked previously
|
// Event IDs of failures that were tracked previously
|
||||||
trackedEventHashMap = {
|
trackedEventHashMap = {
|
||||||
// [eventIdHash(eventId)]: true
|
// [eventId]: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Spread the load on `Analytics` by sending at most 1 event per
|
// Spread the load on `Analytics` by sending at most 1 event per
|
||||||
|
@ -130,7 +126,7 @@ export default class DecryptionFailureTracker {
|
||||||
// Only track one failure per event
|
// Only track one failure per event
|
||||||
const dedupedFailuresMap = failuresGivenGrace.reduce(
|
const dedupedFailuresMap = failuresGivenGrace.reduce(
|
||||||
(map, failure) => {
|
(map, failure) => {
|
||||||
if (!this.trackedEventHashMap[eventIdHash(failure.failedEventId)]) {
|
if (!this.trackedEventHashMap[failure.failedEventId]) {
|
||||||
return map.set(failure.failedEventId, failure);
|
return map.set(failure.failedEventId, failure);
|
||||||
} else {
|
} else {
|
||||||
return map;
|
return map;
|
||||||
|
@ -143,7 +139,7 @@ export default class DecryptionFailureTracker {
|
||||||
const trackedEventIds = [...dedupedFailuresMap.keys()];
|
const trackedEventIds = [...dedupedFailuresMap.keys()];
|
||||||
|
|
||||||
this.trackedEventHashMap = trackedEventIds.reduce(
|
this.trackedEventHashMap = trackedEventIds.reduce(
|
||||||
(result, eventId) => ({...result, [eventIdHash(eventId)]: true}),
|
(result, eventId) => ({...result, [eventId]: true}),
|
||||||
this.trackedEventHashMap,
|
this.trackedEventHashMap,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue