mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +00:00
Merge pull request #744 from resin-io/throttle-not-debounce
fix: Use throttle not debounce when ensuring we don't spam mixpanel
This commit is contained in:
commit
5e396e26b9
@ -86,12 +86,12 @@ export class EventTracker {
|
||||
}
|
||||
|
||||
properties = this.assignDefaultProperties(properties);
|
||||
this.debouncedLogger(event)(properties);
|
||||
this.throttleddLogger(event)(properties);
|
||||
}
|
||||
|
||||
private debouncedLogger = memoizee((event: string) => {
|
||||
private throttleddLogger = memoizee((event: string) => {
|
||||
// Call this function at maximum once every minute
|
||||
return _.debounce((properties) => {
|
||||
return _.throttle((properties) => {
|
||||
this.client.track(event, properties);
|
||||
}, eventDebounceTime, { leading: true });
|
||||
}, { primitive: true });
|
||||
|
Loading…
Reference in New Issue
Block a user