Skip to content

Conversation

@shirzady1934
Copy link
Contributor

This PR introduces a configurable polling interval for awaitWorkflowResult, enabling users to control how frequently GetResult() polls the database for workflow completion. Previously, the polling interval was fixed at _DB_RETRY_INTERVAL, with no way to adjust it. This change adds flexibility for workloads that require faster responsiveness or reduced DB query pressure.

Functional Option: WithPollingInterval()

  • Adds a new functional option for GetResult():
    func WithPollingInterval(interval time.Duration) GetResultOption

@maxdml
Copy link
Collaborator

maxdml commented Nov 21, 2025

@shirzady1934 Thanks for the PR! The implementation looks good to me, but let's make a simpler test. What we can do is repurpose TestWorkflowHandleTimeout into a TestWorkflowHandles suite, and change the GetResult calls to have a custom interval.

Checking the value was exactly set isn't worth the huge new test file imo

@shirzady1934
Copy link
Contributor Author

Thanks for the feedback, @maxdwell. I updated the PR to match your suggestion. I removed the separate workflow_getresult_options_test.go file and folded the polling-interval checks into the existing tests. The previous TestWorkflowHandleTimeout is now a small suite called TestWorkflowHandles, and both subtests use WithPollingInterval(1 * time.Millisecond) in their GetResult calls. This exercises the new option through normal workflow execution without inspecting internal fields or introducing new mocks, keeping the tests simple and consistent with your guidance. Let me know if you’d like any further adjustments.

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.

2 participants