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

Set auto config hint for empty polls #6611

Merged
merged 10 commits into from
Jan 14, 2025
8 changes: 8 additions & 0 deletions service/matching/handler/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ pollLoop:
if err != nil {
return nil, fmt.Errorf("couldn't load tasklist namanger: %w", err)
}
pollerWaitTimeMs := int64(0)
if deadline, ok := pollerCtx.Deadline(); ok {
pollerWaitTimeMs = int64(time.Until(deadline).Milliseconds())
}
task, err := tlMgr.GetTask(pollerCtx, nil)
if err != nil {
// TODO: Is empty poll the best reply for errPumpClosed?
Expand All @@ -564,6 +568,10 @@ pollLoop:
return &types.MatchingPollForDecisionTaskResponse{
PartitionConfig: tlMgr.TaskListPartitionConfig(),
LoadBalancerHints: tlMgr.LoadBalancerHints(),
AutoConfigHint: &types.AutoConfigHint{
EnableAutoConfig: tlMgr.EnableClientAutoConfig(),
PollerWaitTimeInMs: pollerWaitTimeMs,
},
}, nil
}
return nil, fmt.Errorf("couldn't get task: %w", err)
Expand Down
1 change: 1 addition & 0 deletions service/matching/tasklist/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type (
UpdateTaskListPartitionConfig(context.Context, *types.TaskListPartitionConfig) error
RefreshTaskListPartitionConfig(context.Context, *types.TaskListPartitionConfig) error
LoadBalancerHints() *types.LoadBalancerHints
EnableClientAutoConfig() bool
}

TaskMatcher interface {
Expand Down
14 changes: 14 additions & 0 deletions service/matching/tasklist/interfaces_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions service/matching/tasklist/task_list_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,11 @@ func (c *taskListManagerImpl) emitMisconfiguredPartitionMetrics() {
}
}

// EnableClientAutoConfig checks if there client auto config is enabled for tasklist
func (c *taskListManagerImpl) EnableClientAutoConfig() bool {
return c.config.EnableClientAutoConfig()
}

func getTaskListTypeTag(taskListType int) metrics.Tag {
switch taskListType {
case persistence.TaskListTypeActivity:
Expand Down
Loading