-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix race condition with client registration. (#750)
During initialization the js-client-sdk does some context processing. This is an async operation which will add keys to anonymous contexts. Being as this doesn't happen synchronously within the initialization call there is a possibility that you register the telemetry SDK before that initialization is complete. This PR updates the registration to attempt to wait for initialization. This is a larger window than we need to wait, but ensures that process will be complete.
- Loading branch information
1 parent
18e1aae
commit d2ac2e2
Showing
4 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/telemetry/browser-telemetry/src/api/client/LDClientInitialization.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Minimal client interface which allows waiting for initialization. | ||
*/ | ||
export interface LDClientInitialization { | ||
waitForInitialization(timeout?: number): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './LDClientTracking'; | ||
export * from './LDClientLogging'; | ||
export * from './BrowserTelemetryInspector'; | ||
export * from './LDClientInitialization'; |