Track UISIs in bulk

Piwik supports sending an event value, which we can use to indicate
cardinality of UISIs to be tracked instead of tracking them individually.

This means we can track them at a lower frequency of (fairly arbitrary)
60s.
This commit is contained in:
Luke Barnard 2018-06-28 15:03:47 +01:00
parent 48f03bfd86
commit 01dd387970
4 changed files with 21 additions and 47 deletions

View file

@ -40,9 +40,8 @@ export default class DecryptionFailureTracker {
checkInterval = null;
trackInterval = null;
// Spread the load on `Analytics` by sending at most 1 event per
// `TRACK_INTERVAL_MS`.
static TRACK_INTERVAL_MS = 1000;
// Spread the load on `Analytics` by tracking at a low frequency, `TRACK_INTERVAL_MS`.
static TRACK_INTERVAL_MS = 60000;
// Call `checkFailures` every `CHECK_INTERVAL_MS`.
static CHECK_INTERVAL_MS = 5000;
@ -163,7 +162,8 @@ export default class DecryptionFailureTracker {
*/
trackFailure() {
if (this.failuresToTrack.length > 0) {
this.trackDecryptionFailure(this.failuresToTrack.shift());
// Remove all failures, and expose the number of failures
this.trackDecryptionFailure(this.failuresToTrack.splice(0).length);
}
}
}