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

IWF-163: Add retry policy to QueryWorkflow calls #491

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lwolczynski
Copy link
Contributor

Description

Checklist

  • Code compiles correctly
  • Tests for the changes have been added
  • All tests passing
  • This PR change is backwards-compatible
  • This PR CONTAINS a (planned) breaking change (it is not backwards compatible)

Related Issue

Closes #437

Comment on lines +127 to +131
retryPolicy := temporalapi.QueryWorkflowFailedRetryPolicy{
InitialIntervalSeconds: config.GetInitialIntervalSecondsWithDefault(),
MaximumAttempts: config.GetMaximumAttemptsWithDefault(),
}
unifiedClient = temporalapi.NewTemporalClient(temporalClient, config.Interpreter.Temporal.Namespace, converter.GetDefaultDataConverter(), false, retryPolicy)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you have config.GetInitialIntervalSecondsWithDefault(), then the expectation is that the code that need to use the value will call it to get the value with default, instead of passing into here.

So it will be temporalapi.NewTemporalClient(temporalClient, config.Interpreter.Temporal.Namespace, converter.GetDefaultDataConverter(), false, config.ApiConfig.QueryRetryPolicy)

Also consider using pointers to make this optional and load the default values in client.go.
Basically the config can be defined it as a pointer instead of struct. So that internally, we just need to pass a nil into this, which should let it use the default value.

qres, err = queryWorkflowWithStrongConsistency(t, ctx, workflowID, runID, queryType, args)
if err != nil {
if t.isQueryFailedError(err) {
if attempt == t.queryWorkflowFailedRetryPolicy.MaximumAttempts {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I don't think we need another check here, since it'a already checked by the for loop condition?

Although we will have to check err != nil again outside of the loop

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.

Refactor persistence_test and move API call retry to API Service
2 participants