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-136: Support initial data attributes when starting workflow #435

Merged
merged 6 commits into from
Sep 30, 2024

Conversation

lwolczynski
Copy link
Contributor

No description provided.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
WorkflowConfigOverride: config,
UseMemoForDataAttributes: ptr.Any(useMemo),
},
}
_, httpResp, err := reqStart.WorkflowStartRequest(wfReq).Execute()
panicAtHttpError(err, httpResp)

// TODO: Fix the issue with running queryHandler before new workflow which Continues as New has started
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking into the code again, I now remember..
We intentionally set the query handler after the continueAsNew/dumpInternal activity. https://github.com/indeedeng/iwf/blob/main/service/interpreter/workflowImpl.go#L98

This is to ensure the correctness. If we set the query handler before that, the query handler could return empty data(since the loading hasn't completed), which will be incorrect response.

So we would rather return server errors and let the client retry later.

Copy link
Contributor

@longquanzheng longquanzheng Sep 27, 2024

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.

For this test, we can add a comment to explain why a sleep is necessary

WorkflowConfigOverride: config,
UseMemoForDataAttributes: ptr.Any(useMemo),
},
}
_, httpResp, err := reqStart.WorkflowStartRequest(wfReq).Execute()
panicAtHttpError(err, httpResp)

// TODO: Fix the issue with running queryHandler before new workflow which Continues as New has started
time.Sleep(time.Millisecond * 10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the test failed. I looked at my other sleeps for the same reasons, I used 1 second for safety. Also it's better to only sleep for continueAsNew cases. (the test will run faster that way)

Comment on lines 168 to 172
// Config is only present for continueAsNew tests
if config != nil {
// TODO: Fix the issue with running queryHandler before new workflow which Continues as New has started
time.Sleep(time.Millisecond * 1000)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bumped the sleep to 1 second and wrapped it in a check if config is present

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +175 to +186
// Config is only present for continueAsNew tests
if config != nil {
for {
if err == nil || retryCount >= 5 {
break
}
// Loading data to a continuedAsNew workflow might take a few seconds thus retry mechanism is needed
time.Sleep(time.Millisecond * 1000)
retryCount += 1
queryResult, httpResp, err = getDataAttributes(initReqQry, wfId, expectedDataAttribute, useMemo)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@longquanzheng what are your thoughts about this?

Copy link
Contributor

@longquanzheng longquanzheng Sep 30, 2024

Choose a reason for hiding this comment

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

That's good. I was thinking about the same way to workaround.

However, ideally we can do this in api service for everyone (that will saves all the sleeping in the tests).

But it's better to do in a separate PR (need to figure out checking error types, and backoff strategy and refactoring all the tests to remove the sleep).

Could you also raise another ticket for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do!

@lwolczynski lwolczynski merged commit e0c4caa into main Sep 30, 2024
6 checks passed
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.

None yet

2 participants