Browse Source

updates SubscriptionService to only track changes

main
Keith Daulton 2 years ago
parent
commit
1bb02230d8
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      src/plus/subscription/subscriptionService.ts

+ 4
- 7
src/plus/subscription/subscriptionService.ts View File

@ -847,6 +847,9 @@ export class SubscriptionService implements Disposable {
// Check the previous and new subscriptions are exactly the same // Check the previous and new subscriptions are exactly the same
const matches = previous != null && JSON.stringify(previous) === JSON.stringify(subscription); const matches = previous != null && JSON.stringify(previous) === JSON.stringify(subscription);
// If the previous and new subscriptions are exactly the same, kick out
if (matches) return;
queueMicrotask(() => { queueMicrotask(() => {
this.container.telemetry.setGlobalAttributes({ this.container.telemetry.setGlobalAttributes({
'account.id': subscription!.account?.id, 'account.id': subscription!.account?.id,
@ -889,15 +892,9 @@ export class SubscriptionService implements Disposable {
: {}), : {}),
}; };
this.container.telemetry.sendEvent(
previous == null || matches ? 'subscription' : 'subscription/changed',
data,
);
this.container.telemetry.sendEvent(previous == null ? 'subscription' : 'subscription/changed', data);
}); });
// If the previous and new subscriptions are exactly the same, kick out
if (matches) return;
void this.storeSubscription(subscription); void this.storeSubscription(subscription);
this._subscription = subscription; this._subscription = subscription;

Loading…
Cancel
Save