Skip to content

Commit e7776be

Browse files
committed
populate autoconfig hint field
1 parent defc47b commit e7776be

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

internal/internal_task_handlers.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,17 @@ type (
8585
// workflowTask wraps a decision task.
8686
workflowTask struct {
8787
task *s.PollForDecisionTaskResponse
88+
autoConfigHint *s.AutoConfigHint
8889
historyIterator HistoryIterator
8990
doneCh chan struct{}
9091
laResultCh chan *localActivityResult
9192
}
9293

9394
// activityTask wraps a activity task.
9495
activityTask struct {
95-
task *s.PollForActivityTaskResponse
96-
pollStartTime time.Time
96+
task *s.PollForActivityTaskResponse
97+
autoConfigHint *s.AutoConfigHint
98+
pollStartTime time.Time
9799
}
98100

99101
// resetStickinessTask wraps a ResetStickyTaskListRequest.
@@ -167,14 +169,14 @@ func (t *workflowTask) getAutoConfigHint() *s.AutoConfigHint {
167169
if t.task != nil {
168170
return t.task.AutoConfigHint
169171
}
170-
return nil
172+
return t.autoConfigHint
171173
}
172174

173175
func (t *activityTask) getAutoConfigHint() *s.AutoConfigHint {
174176
if t.task != nil {
175177
return t.task.AutoConfigHint
176178
}
177-
return nil
179+
return t.autoConfigHint
178180
}
179181

180182
func newHistory(task *workflowTask, eventsHandler *workflowExecutionEventHandlerImpl) *history {

internal/internal_task_pollers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ func (wtp *workflowTaskPoller) poll(ctx context.Context) (interface{}, error) {
848848
if response == nil || len(response.TaskToken) == 0 {
849849
wtp.metricsScope.Counter(metrics.DecisionPollNoTaskCounter).Inc(1)
850850
wtp.updateBacklog(request.TaskList.GetKind(), 0)
851-
return &workflowTask{}, nil
851+
return &workflowTask{autoConfigHint: response.GetAutoConfigHint()}, nil
852852
}
853853

854854
wtp.updateBacklog(request.TaskList.GetKind(), response.GetBacklogCountHint())
@@ -1116,7 +1116,7 @@ func (atp *activityTaskPoller) pollWithMetrics(ctx context.Context,
11161116
return nil, err
11171117
}
11181118
if response == nil || len(response.TaskToken) == 0 {
1119-
return &activityTask{}, nil
1119+
return &activityTask{autoConfigHint: response.GetAutoConfigHint()}, nil
11201120
}
11211121

11221122
workflowType := response.WorkflowType.GetName()

internal/internal_worker_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,13 +1514,25 @@ func TestGetTaskAutoConfigHint(t *testing.T) {
15141514
{
15151515
"decision task",
15161516
&workflowTask{
1517-
&shared.PollForDecisionTaskResponse{AutoConfigHint: &hint}, nil, nil, nil},
1517+
task: &shared.PollForDecisionTaskResponse{AutoConfigHint: &hint}},
1518+
&hint,
1519+
},
1520+
{
1521+
"empty decision task",
1522+
&workflowTask{
1523+
autoConfigHint: &hint},
15181524
&hint,
15191525
},
15201526
{
15211527
"activity task",
15221528
&activityTask{
1523-
&shared.PollForActivityTaskResponse{AutoConfigHint: &hint}, time.Now()},
1529+
task: &shared.PollForActivityTaskResponse{AutoConfigHint: &hint}},
1530+
&hint,
1531+
},
1532+
{
1533+
"empty activity task",
1534+
&activityTask{
1535+
autoConfigHint: &hint},
15241536
&hint,
15251537
},
15261538
{

0 commit comments

Comments
 (0)