Skip to content

Commit 670d213

Browse files
Update detroy method to stop uniqueKeysTracker jobs in the main client only
1 parent bcdff09 commit 670d213

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/sdkClient/sdkClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
6666
syncManager && syncManager.stop();
6767

6868
return __flush().then(() => {
69-
// Cleanup event listeners
70-
signalListener && signalListener.stop();
71-
72-
// @TODO stop only if last client is destroyed
73-
if (uniqueKeysTracker) uniqueKeysTracker.stop();
69+
// For main client, cleanup event listeners and scheduled jobs
70+
if (!isSharedClient) {
71+
signalListener && signalListener.stop();
72+
uniqueKeysTracker && uniqueKeysTracker.stop();
73+
}
7474

7575
// Cleanup storage
7676
return storage.destroy();

src/sdkClient/sdkClientMethodCS.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
7171
sdkReadinessManager: sharedSdkReadiness,
7272
storage: sharedStorage || storage,
7373
syncManager: sharedSyncManager,
74-
signalListener: undefined, // only the main client "destroy" method stops the signal listener
7574
}), true) as SplitIO.IClient,
7675
validKey
7776
);

src/sdkClient/sdkClientMethodCSWithTT.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
8181
sdkReadinessManager: sharedSdkReadiness,
8282
storage: sharedStorage || storage,
8383
syncManager: sharedSyncManager,
84-
signalListener: undefined, // only the main client "destroy" method stops the signal listener
8584
}), true) as SplitIO.IClient,
8685
validKey,
8786
validTrafficType

0 commit comments

Comments
 (0)