-
Notifications
You must be signed in to change notification settings - Fork 31
feat: add initial polling retries to BrowserDataManager #1030
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
Conversation
This update introduces a new option for initial polling retries in the BrowserDataManager. Changes: - The `initialPollingRetries` parameter has been added to the `BrowserIdentifyOptions` interface, allowing users to specify the maximum number of retries for the initial polling request, defaulting to 3. - The `_requestPayload` method has been refactored to implement this retry logic, enhancing the robustness of the polling mechanism.
|
@launchdarkly/browser size report |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
This commit will: - introduce new unit tests - fixed a counting issue with retries
45f9762 to
9a9e637
Compare
|
@launchdarkly/js-client-sdk size report |
| lastError = e; | ||
| // NOTE: current we are hardcoding the retry interval to 1 second. | ||
| // We can make this configurable in the future. | ||
| // TODO: Reviewer any thoughts on this? Probably the easiest thing is to make this configurable |
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.
This is a reasonable start, and then we should look at adding some backoff to it later.
With FDv2 we may consider things a little differently. For example, if streaming is enabled, then this failing just means we may end up initializing from streaming. So we don't want to spend too long on this step.
| * | ||
| * Defaults to 3. | ||
| */ | ||
| initialPollingRetries?: number; |
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.
This is interesting. I had not considered having this at the identify options level, versus being a client-level option. I am tempted to say we just don't expose the lever at all right now. If we do, then we probably do need that back-off logic. Because we don't want to, for example, retry 50 times once per second.
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.
Yea, looking back at this, I agree with not exposing this for now. The original thought was that the identify() method is what really triggers the initialization here so it (kind of) made sense for initialization options to live in identifyOptions. I created another work item to align the initialization with what we have in flutter sdk so this implementation now makes less sense, I'll remove this option for now.
🤖 I have created a release *beep* *boop* --- <details><summary>akamai-edgeworker-sdk-common: 2.0.12</summary> ## [2.0.12](akamai-edgeworker-sdk-common-v2.0.11...akamai-edgeworker-sdk-common-v2.0.12) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from ^2.17.0 to ^2.17.1 </details> <details><summary>akamai-server-base-sdk: 3.0.13</summary> ## [3.0.13](akamai-server-base-sdk-v3.0.12...akamai-server-base-sdk-v3.0.13) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.11 to ^2.0.12 * @launchdarkly/js-server-sdk-common bumped from ^2.17.0 to ^2.17.1 </details> <details><summary>akamai-server-edgekv-sdk: 1.4.15</summary> ## [1.4.15](akamai-server-edgekv-sdk-v1.4.14...akamai-server-edgekv-sdk-v1.4.15) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.11 to ^2.0.12 * @launchdarkly/js-server-sdk-common bumped from ^2.17.0 to ^2.17.1 </details> <details><summary>browser-telemetry: 1.0.14</summary> ## [1.0.14](browser-telemetry-v1.0.13...browser-telemetry-v1.0.14) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-client-sdk bumped from 0.9.1 to 0.10.0 </details> <details><summary>cloudflare-server-sdk: 2.7.12</summary> ## [2.7.12](cloudflare-server-sdk-v2.7.11...cloudflare-server-sdk-v2.7.12) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.6.10 to 2.6.11 </details> <details><summary>fastly-server-sdk: 0.2.4</summary> ## [0.2.4](fastly-server-sdk-v0.2.3...fastly-server-sdk-v0.2.4) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>js-client-sdk: 0.10.0</summary> ## [0.10.0](js-client-sdk-v0.9.1...js-client-sdk-v0.10.0) (2025-12-09) ### Features * add initial polling retries to BrowserDataManager ([#1030](#1030)) ([cd91013](cd91013)) </details> <details><summary>js-server-sdk-common: 2.17.1</summary> ## [2.17.1](js-server-sdk-common-v2.17.0...js-server-sdk-common-v2.17.1) (2025-12-09) ### Bug Fixes * FDv2 initializer readiness ([#1017](#1017)) ([7a3af02](7a3af02)) </details> <details><summary>js-server-sdk-common-edge: 2.6.11</summary> ## [2.6.11](js-server-sdk-common-edge-v2.6.10...js-server-sdk-common-edge-v2.6.11) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>node-server-sdk: 9.10.5</summary> ## [9.10.5](node-server-sdk-v9.10.4...node-server-sdk-v9.10.5) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>node-server-sdk-dynamodb: 6.2.17</summary> ## [6.2.17](node-server-sdk-dynamodb-v6.2.16...node-server-sdk-dynamodb-v6.2.17) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.10.4 to 9.10.5 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.10.5 </details> <details><summary>node-server-sdk-otel: 1.3.5</summary> ## [1.3.5](node-server-sdk-otel-v1.3.4...node-server-sdk-otel-v1.3.5) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.10.4 to 9.10.5 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.10.5 </details> <details><summary>node-server-sdk-redis: 4.2.17</summary> ## [4.2.17](node-server-sdk-redis-v4.2.16...node-server-sdk-redis-v4.2.17) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.10.4 to 9.10.5 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.10.5 </details> <details><summary>server-sdk-ai: 0.15.2</summary> ## [0.15.2](server-sdk-ai-v0.15.1...server-sdk-ai-v0.15.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 * peerDependencies * @launchdarkly/js-server-sdk-common bumped from 2.x to 2.17.1 </details> <details><summary>server-sdk-ai-langchain: 0.4.2</summary> ## [0.4.2](server-sdk-ai-langchain-v0.4.1...server-sdk-ai-langchain-v0.4.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.1 to ^0.15.2 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.0 to ^0.15.2 </details> <details><summary>server-sdk-ai-openai: 0.4.2</summary> ## [0.4.2](server-sdk-ai-openai-v0.4.1...server-sdk-ai-openai-v0.4.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 * @launchdarkly/server-sdk-ai bumped from ^0.15.1 to ^0.15.2 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.0 to ^0.15.2 </details> <details><summary>server-sdk-ai-vercel: 0.4.2</summary> ## [0.4.2](server-sdk-ai-vercel-v0.4.1...server-sdk-ai-vercel-v0.4.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.1 to ^0.15.2 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.0 to ^0.15.2 </details> <details><summary>shopify-oxygen-sdk: 0.1.2</summary> ## [0.1.2](shopify-oxygen-sdk-v0.1.1...shopify-oxygen-sdk-v0.1.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>vercel-server-sdk: 1.3.37</summary> ## [1.3.37](vercel-server-sdk-v1.3.36...vercel-server-sdk-v1.3.37) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.6.10 to 2.6.11 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Cuts a release with a browser SDK feature and a core bug fix, plus widespread version and dependency bumps across AI, server, edge, telemetry, and store packages. > > - **Features** > - Browser SDK (`@launchdarkly/js-client-sdk`) `0.10.0`: add initial polling retries. > - **Bug Fixes** > - Core server common (`@launchdarkly/js-server-sdk-common`) `2.17.1`: FDv2 initializer readiness. > - **Ecosystem Updates** (versions and embedded `sdkVersion` constants) > - **AI**: `@launchdarkly/server-sdk-ai` → `0.15.2`; providers (`langchain`, `openai`, `vercel`) → `0.4.2` with peer/dev dep bumps. > - **Server/Edge SDKs**: Node `9.10.5`; Cloudflare `2.7.12` (edge common `2.6.11`); Vercel `1.3.37`; Fastly `0.2.4`; Akamai base `3.0.13` and EdgeKV `1.4.15`. > - **Shared**: Edgeworker common `2.0.12`; Edge common `2.6.11`; Server common `2.17.1`. > - **Telemetry**: Browser telemetry `1.0.14` (uses browser SDK `0.10.0`); Node OTEL `1.3.5`. > - **Stores**: DynamoDB `6.2.17`; Redis `4.2.17` (peer/dev deps to Node SDK `9.10.5`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2615b2d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Requirements
Additional context
Note
Adds 3-attempt (1s interval) retry to initial polling in
BrowserDataManager, with tests for success and max-retry failure.packages/sdk/browser/src/BrowserDataManager.ts:_requestPayloadhelper implementing retry for initial poll (max 3 retries, 1s delay) usingshouldRetry,sleep, andhttpErrorMessage._finishIdentifyFromPollto use_requestPayload; maintain error reporting viaDataSourceStatusManager.@launchdarkly/js-client-sdk-common.packages/sdk/browser/__tests__/BrowserDataManager.test.ts):fetch.Written by Cursor Bugbot for commit 6affd78. This will update automatically on new commits. Configure here.