Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update destroy method #347

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/sdkClient/sdkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
syncManager && syncManager.stop();

return __flush().then(() => {
// Cleanup event listeners
signalListener && signalListener.stop();

// @TODO stop only if last client is destroyed
if (uniqueKeysTracker) uniqueKeysTracker.stop();
// For main client, cleanup event listeners and scheduled jobs
if (!isSharedClient) {
signalListener && signalListener.stop();
uniqueKeysTracker && uniqueKeysTracker.stop();
}

// Cleanup storage
return storage.destroy();
Expand Down
1 change: 0 additions & 1 deletion src/sdkClient/sdkClientMethodCS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
sdkReadinessManager: sharedSdkReadiness,
storage: sharedStorage || storage,
syncManager: sharedSyncManager,
signalListener: undefined, // only the main client "destroy" method stops the signal listener
}), true) as SplitIO.IClient,
validKey
);
Expand Down
1 change: 0 additions & 1 deletion src/sdkClient/sdkClientMethodCSWithTT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
sdkReadinessManager: sharedSdkReadiness,
storage: sharedStorage || storage,
syncManager: sharedSyncManager,
signalListener: undefined, // only the main client "destroy" method stops the signal listener
}), true) as SplitIO.IClient,
validKey,
validTrafficType
Expand Down
Loading