-
Notifications
You must be signed in to change notification settings - Fork 31
feat: Add identify timeout to client-sdk. #420
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
feat: Add identify timeout to client-sdk. #420
Conversation
|
This pull request has been linked to Shortcut Story #239001: Add identify timeout option to rn sdk. |
…ify its own value. Set rn default to 15s.
| setTimeout(() => { | ||
| const e = `${taskName} timed out after ${t} seconds.`; | ||
| logger?.error(e); | ||
| reject(new Error(e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have concerns with rejecting the promise. Being as this condition will not normally encountered it may result in broken apps instead of safer apps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I know the node SDK does it, but I am not certain that is a good idea either.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an issue with resolving. However the breaking side-effect is identify now returns Promise<void | Error> rather than just Promise<void>.
If we stay with rejecting, the identify promise should be caught by the consumer. This is an accepted safe practice. If we document this clearly I think the risk of breaking apps is low.
| context?: LDContext; | ||
| diagnosticsManager?: internal.DiagnosticsManager; | ||
| eventProcessor?: internal.EventProcessor; | ||
| identifyTimeout: number = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Harcoded to 5s by default. This will be set in identify if provided.
| async identify(pristineContext: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void> { | ||
| if (identifyOptions?.timeout) { | ||
| this.identifyTimeout = identifyOptions.timeout; | ||
| } | ||
|
|
||
| if (this.identifyTimeout > this.highTimeoutThreshold) { | ||
| this.logger.warn('identify called with high timeout parameter.'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shout: This is the core change.
louis-launchdarkly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, because JS support default parameter (so it is not a breaking signature change), and the identify method can already error for other reason, adding and defaulting the timeout doesn't count as a behavior breaking change.
If that is the case, this should be the fix and approved.
🤖 I have created a release *beep* *boop* --- <details><summary>akamai-edgeworker-sdk-common: 1.1.3</summary> ## [1.1.3](akamai-edgeworker-sdk-common-v1.1.2...akamai-edgeworker-sdk-common-v1.1.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from ^2.2.2 to ^2.2.3 </details> <details><summary>akamai-server-base-sdk: 2.1.3</summary> ## [2.1.3](akamai-server-base-sdk-v2.1.2...akamai-server-base-sdk-v2.1.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.1.2 to ^1.1.3 * @launchdarkly/js-server-sdk-common bumped from ^2.2.2 to ^2.2.3 </details> <details><summary>akamai-server-edgekv-sdk: 1.1.3</summary> ## [1.1.3](akamai-server-edgekv-sdk-v1.1.2...akamai-server-edgekv-sdk-v1.1.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.1.2 to ^1.1.3 * @launchdarkly/js-server-sdk-common bumped from ^2.2.2 to ^2.2.3 </details> <details><summary>cloudflare-server-sdk: 2.5.0</summary> ## [2.5.0](cloudflare-server-sdk-v2.4.2...cloudflare-server-sdk-v2.5.0) (2024-04-09) ### Features * JSR support for Cloudflare SDK. ([#415](#415)) ([30866f3](30866f3)) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.2.2 to 2.2.3 </details> <details><summary>js-client-sdk-common: 1.1.0</summary> ## [1.1.0](js-client-sdk-common-v1.0.3...js-client-sdk-common-v1.1.0) (2024-04-09) ### Features * Add identify timeout to client-sdk. ([#420](#420)) ([5d73dfe](5d73dfe)) ### Bug Fixes * Identify incorrectly rejected in client-sdk ([#426](#426)) ([a019dd6](a019dd6)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.3.1 to 2.4.0 </details> <details><summary>js-sdk-common: 2.4.0</summary> ## [2.4.0](js-sdk-common-v2.3.1...js-sdk-common-v2.4.0) (2024-04-09) ### Features * Add identify timeout to client-sdk. ([#420](#420)) ([5d73dfe](5d73dfe)) ### Bug Fixes * Identify incorrectly rejected in client-sdk ([#426](#426)) ([a019dd6](a019dd6)) </details> <details><summary>js-server-sdk-common: 2.2.3</summary> ## [2.2.3](js-server-sdk-common-v2.2.2...js-server-sdk-common-v2.2.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.3.1 to 2.4.0 </details> <details><summary>js-server-sdk-common-edge: 2.2.3</summary> ## [2.2.3](js-server-sdk-common-edge-v2.2.2...js-server-sdk-common-edge-v2.2.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.2.2 to 2.2.3 </details> <details><summary>node-server-sdk: 9.2.3</summary> ## [9.2.3](node-server-sdk-v9.2.2...node-server-sdk-v9.2.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.2.2 to 2.2.3 </details> <details><summary>node-server-sdk-dynamodb: 6.1.6</summary> ## [6.1.6](node-server-sdk-dynamodb-v6.1.5...node-server-sdk-dynamodb-v6.1.6) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.2.2 to 9.2.3 * peerDependencies * @launchdarkly/node-server-sdk bumped from 9.2.1 to 9.2.3 </details> <details><summary>node-server-sdk-redis: 4.1.6</summary> ## [4.1.6](node-server-sdk-redis-v4.1.5...node-server-sdk-redis-v4.1.6) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.2.2 to 9.2.3 * peerDependencies * @launchdarkly/node-server-sdk bumped from 9.2.1 to 9.2.3 </details> <details><summary>react-native-client-sdk: 10.1.0</summary> ## [10.1.0](react-native-client-sdk-v10.0.5...react-native-client-sdk-v10.1.0) (2024-04-09) ### Features * Add identify timeout to client-sdk. ([#420](#420)) ([5d73dfe](5d73dfe)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.0.3 to 1.1.0 </details> <details><summary>vercel-server-sdk: 1.3.4</summary> ## [1.3.4](vercel-server-sdk-v1.3.3...vercel-server-sdk-v1.3.4) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.2.2 to 2.2.3 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
No description provided.