fix: initialization request cancelled by poller on slow network#118
Draft
duyhungtnn wants to merge 1 commit intomainfrom
Draft
fix: initialization request cancelled by poller on slow network#118duyhungtnn wants to merge 1 commit intomainfrom
duyhungtnn wants to merge 1 commit intomainfrom
Conversation
Make evaluation polling opt-in by default: add an 'enabled' flag and enable() API to EvaluationForegroundTask and EvaluationBackgroundTask, and update TaskScheduler to create evaluation tasks disabled by default. Add TaskScheduler.enableEvaluationTask() to enable both foreground and background evaluation tasks. Update BKTClient to call enableEvaluationTask() after the initial fetch completes (success or failure) to avoid the background poller interfering with initialization. Add comprehensive unit tests (EvaluationTaskEnabledTests) to verify disabled-by-default behavior, enabling, and that tasks remain enabled after init success/failure. Also add .github/copilot-instructions.md documentation for repository guidance.
Collaborator
Author
|
During testing the iOS, I saw this error only one when I have a super slow network connection. Request Cancellation Issue in BKTClient InitializationThe ProblemThe foreground poller can cancel the initial What happens:
When: During server deployments with 499 errors when retries exceed 60 seconds. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a mechanism to control when evaluation polling tasks (foreground and background) are enabled in the Bucketeer SDK, ensuring that no polling occurs during client initialization and preventing race conditions or request cancellations. The change also adds comprehensive tests to validate the new behavior and updates documentation for developer guidance.
Task enable/disable mechanism for evaluation polling:
enabledflag toEvaluationForegroundTaskandEvaluationBackgroundTask, with methods to enable tasks after initialization completes. Tasks are now constructed withenabled: falseand only enabled after the initial fetch. [1] [2] [3] [4]enabledflag before executing, preventing premature polling during initialization. [1] [2]Integration and scheduling improvements:
TaskSchedulerto provide anenableEvaluationTask()method that enables both foreground and background evaluation tasks after client initialization.BKTClientinitialization flow so that evaluation tasks are enabled only after the initial fetch completes (success or failure), preventing background poller from interfering with initialization.Testing and documentation:
EvaluationTaskEnabledTests.swiftwith five tests to verify task enable/disable behavior, integration, and correct polling after initialization (including failure scenarios)..github/copilot-instructions.mdfor developer and AI tooling guidance.