-
Notifications
You must be signed in to change notification settings - Fork 132
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
Populate tasks in internal workflowTask and activityTask entities for empty polls #1416
Conversation
internal/internal_task_handlers.go
Outdated
@@ -75,15 +75,17 @@ type ( | |||
// workflowTask wraps a decision task. | |||
workflowTask struct { | |||
task *s.PollForDecisionTaskResponse | |||
autoConfigHint *s.AutoConfigHint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can not we reuse the autoConfigHint inside task(PollForDecisionTaskResponse) here? I'm assuming task != nil will mess up the logic somewhere else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tried. But the field is widely used in many different places. Breaking the Nilness assumption might mess it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the new field. It's a redundant information and requires each instantiation of workflowTask/activityTask to fill it based on the response.
Instead expose a helper function such as:
func (wt *workflowTask) GetAutoConfigHint() *s.AutoConfigHint {
if wt.task == nil {
return nil
}
return wt.task.GetAutoConfigHint()
Less code to write and maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I checked carefully. We can populate this task field for empty polls. Thus I've changed the title as well.
common.PtrOf(int64(1000)), | ||
}, | ||
} | ||
for _, tt := range []struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also add nil cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually not possible for client to return nil, nil
for both response and error so I'll skip the test
e16fdbc
to
5f75c34
Compare
What changed?
ensure task field is populated in workflowTask and activityTask for empty polls.
Why?
Task response even with empty task contains information like AutoConfigHint, which is needed for poller auto scaler
How did you test it?
Unit Test
Potential risks