Skip to content

Commit 14d2322

Browse files
committed
handle max poller setting correctly
1 parent 7087b88 commit 14d2322

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

internal/internal_worker.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,13 @@ func newWorkflowTaskWorkerInternal(
276276
domain,
277277
params,
278278
)
279+
pollerCount := params.MaxConcurrentDecisionTaskPollers
280+
if params.AutoScalerOptions.Enabled {
281+
pollerCount = params.AutoScalerOptions.PollerMaxCount
282+
}
279283
worker := newBaseWorker(baseWorkerOptions{
280284
pollerAutoScaler: params.AutoScalerOptions,
281-
pollerCount: params.MaxConcurrentDecisionTaskPollers,
285+
pollerCount: pollerCount,
282286
pollerRate: defaultPollerRate,
283287
maxConcurrentTask: params.MaxConcurrentDecisionTaskExecutionSize,
284288
maxTaskPerSecond: params.WorkerDecisionTasksPerSecond,
@@ -468,10 +472,14 @@ func newActivityTaskWorker(
468472
workerType string,
469473
) (worker *activityWorker) {
470474
ensureRequiredParams(&workerParams)
475+
pollerCount := workerParams.MaxConcurrentActivityTaskPollers
476+
if workerParams.AutoScalerOptions.Enabled {
477+
pollerCount = workerParams.AutoScalerOptions.PollerMaxCount
478+
}
471479
base := newBaseWorker(
472480
baseWorkerOptions{
473481
pollerAutoScaler: workerParams.AutoScalerOptions,
474-
pollerCount: workerParams.MaxConcurrentActivityTaskPollers,
482+
pollerCount: pollerCount,
475483
pollerRate: defaultPollerRate,
476484
maxConcurrentTask: workerParams.MaxConcurrentActivityExecutionSize,
477485
maxTaskPerSecond: workerParams.WorkerActivitiesPerSecond,

internal/worker.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,15 @@ type (
8181
// cadence-server to retrieve activity tasks. Changing this value will affect the
8282
// rate at which the worker is able to consume tasks from a task list.
8383
// Default value is 2
84+
// NOTE: if AutoScalerOptions.Enabled is set to true, this value will be ignored and AutoScalerOptions.PollerMaxCount will be used instead
8485
MaxConcurrentActivityTaskPollers int
8586

8687
// optional: Sets the minimum number of goroutines that will concurrently poll the
8788
// cadence-server to retrieve activity tasks. Changing this value will NOT affect the
8889
// rate at which the worker is able to consume tasks from a task list,
8990
// unless FeatureFlags.PollerAutoScalerEnabled is set to true.
9091
// Default value is 1
91-
// Deprecated: Use AutoScalerOptions instead.
92+
// Deprecated: No effect and use AutoScalerOptions instead.
9293
MinConcurrentActivityTaskPollers int
9394

9495
// Optional: To set the maximum concurrent decision task executions this worker can have.
@@ -105,13 +106,14 @@ type (
105106
// cadence-server to retrieve decision tasks. Changing this value will affect the
106107
// rate at which the worker is able to consume tasks from a task list.
107108
// Default value is 2
109+
// NOTE: if AutoScalerOptions.Enabled is set to true, this value will be ignored and AutoScalerOptions.PollerMaxCount will be used instead
108110
MaxConcurrentDecisionTaskPollers int
109111

110112
// optional: Sets the minimum number of goroutines that will concurrently poll the
111113
// cadence-server to retrieve decision tasks. If FeatureFlags.PollerAutoScalerEnabled is set to true,
112114
// changing this value will NOT affect the rate at which the worker is able to consume tasks from a task list.
113115
// Default value is 2
114-
// Deprecated: Use AutoScalerOptions instead.
116+
// Deprecated: NO effect and use AutoScalerOptions instead.
115117
MinConcurrentDecisionTaskPollers int
116118

117119
// optional: Sets the interval of poller autoscaling, between which poller autoscaler changes the poller count

0 commit comments

Comments
 (0)