From 1bb02230d8ba8943e789297df81eca90035e9563 Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Tue, 29 Nov 2022 15:01:30 -0500 Subject: [PATCH] updates SubscriptionService to only track changes --- src/plus/subscription/subscriptionService.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/plus/subscription/subscriptionService.ts b/src/plus/subscription/subscriptionService.ts index 66702bd..8cde3d7 100644 --- a/src/plus/subscription/subscriptionService.ts +++ b/src/plus/subscription/subscriptionService.ts @@ -847,6 +847,9 @@ export class SubscriptionService implements Disposable { // Check the previous and new subscriptions are exactly the same 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(() => { this.container.telemetry.setGlobalAttributes({ '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); this._subscription = subscription;