Skip to content

Commit bcf3591

Browse files
Updated client method to release SDK key immediately and avoid unexpected warning logs
1 parent b8ee8c6 commit bcf3591

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.13.1 (January 13, 2024)
2+
- Updated client `destroy` method to release SDK key immediately and avoid unexpected warning logs when a factory is created with the same SDK key after the previous one was destroyed.
3+
14
1.13.0 (January 4, 2024)
25
- Removed the `getOptions` method from the `IPlatform` interface to simplify implementation. Request options can be handled within the `getFetch` method.
36

src/sdkClient/sdkClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
5656
// Mark the SDK as destroyed immediately
5757
sdkReadinessManager.readinessManager.destroy();
5858

59-
// record stat before flushing data
60-
if (!isSharedClient) telemetryTracker.sessionLength();
59+
// For main client, release the SDK Key and record stat before flushing data
60+
if (!isSharedClient) {
61+
releaseApiKey(settings.core.authorizationKey);
62+
telemetryTracker.sessionLength();
63+
}
6164

6265
// Stop background jobs
6366
syncManager && syncManager.stop();
@@ -66,9 +69,6 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
6669
// Cleanup event listeners
6770
signalListener && signalListener.stop();
6871

69-
// Release the SDK Key if it is the main client
70-
if (!isSharedClient) releaseApiKey(settings.core.authorizationKey);
71-
7272
// @TODO stop only if last client is destroyed
7373
if (uniqueKeysTracker) uniqueKeysTracker.stop();
7474

0 commit comments

Comments
 (0)