Skip to content

Commit 58e9ad0

Browse files
Merge pull request #347 from splitio/update_destroy_method
Update `destroy` method
2 parents 101b70a + f17519b commit 58e9ad0

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
@@ -76,7 +76,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
7676
sdkReadinessManager: sharedSdkReadiness,
7777
storage: sharedStorage || storage,
7878
syncManager: sharedSyncManager,
79-
signalListener: undefined, // only the main client "destroy" method stops the signal listener
8079
}), true) as SplitIO.IClient,
8180
validKey
8281
);

src/sdkClient/sdkClientMethodCSWithTT.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
8686
sdkReadinessManager: sharedSdkReadiness,
8787
storage: sharedStorage || storage,
8888
syncManager: sharedSyncManager,
89-
signalListener: undefined, // only the main client "destroy" method stops the signal listener
9089
}), true) as SplitIO.IClient,
9190
validKey,
9291
validTrafficType

0 commit comments

Comments
 (0)