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

Add support for skipInitialPoll parameter (FF-2084) #64

Merged
merged 4 commits into from
May 16, 2024

Conversation

leoromanovsky
Copy link
Member


labels: mergeable

Fixes: #issue

Motivation and Context

Customers can elect to put the client SDK into "offline" mode - one of the configurations they need to enable is preventing the SDK from performing a CDN fetch during the init method.

Subsequent calls to the CDN will be blocked by setting the isExpired function in the persistence store implementations.

Description

  • adds support for js-commons skipInitialPoll

How has this been tested?

@leoromanovsky leoromanovsky marked this pull request as ready for review May 15, 2024 05:26
Copy link
Contributor

@aarsilv aarsilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📈

@@ -507,6 +507,28 @@ describe('initialization options', () => {
expect(client.getStringAssignment(flagKey, 'subject', {}, 'default-value')).toBe('control');
});

it('skips initial poll', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

assignmentLogger: mockLogger,
skipInitialPoll: true,
});
expect(callCount).toBe(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/index.ts Outdated
/**
* Skip the first poll for new configurations during initialization. (default: false)
*/
skipInitialPoll?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: "poll" implies a request made repeatedly at intervals. skipInitialRequest?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - I was being too pedantic with the mechanics of the internal poller. For customers they are not going to know that and the naming you suggested is more clear 👍 👍

src/index.ts Outdated
@@ -160,6 +165,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
pollAfterSuccessfulInitialization: config.pollAfterSuccessfulInitialization ?? false,
pollAfterFailedInitialization: config.pollAfterFailedInitialization ?? false,
throwOnFailedInitialization: true, // always use true here as underlying instance fetch is surrounded by try/catch
skipInitialPoll: config.skipInitialPoll ?? false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Base automatically changed from lr/ff-1980/no-init2 to main May 16, 2024 22:35
@leoromanovsky leoromanovsky merged commit 6d08baa into main May 16, 2024
2 checks passed
@leoromanovsky leoromanovsky deleted the lr/ff-2084/skip-init branch May 16, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants