@@ -52,7 +52,9 @@ const (
5252 defaultConcurrentPollRoutineSize = 2
5353
5454 defaultMaxConcurrentActivityExecutionSize = 1000 // Large concurrent activity execution size (1k)
55- defaultMaxActivityExecutionRate = 100000 // Large activity execution rate (unlimited)
55+ _defaultWorkerActivitiesPerSecond = 100000 // Large activity executions/sec (unlimited)
56+
57+ _defaultTaskListActivitiesPerSecond = 100000.0 // Large activity executions/sec (unlimited)
5658
5759 defaultMaxConcurrentWorkflowExecutionSize = 50 // hardcoded max workflow execution size.
5860 defaultMaxWorkflowExecutionRate = 100000 // Large workflow execution rate (unlimited)
@@ -108,8 +110,11 @@ type (
108110 // Defines how many concurrent executions for task list by this worker.
109111 ConcurrentActivityExecutionSize int
110112
111- // Defines rate limiting on number of activity tasks that can be executed per second.
112- MaxActivityExecutionPerSecond float64
113+ // Defines rate limiting on number of activity tasks that can be executed per second per worker.
114+ WorkerActivitiesPerSecond float64
115+
116+ // TaskListActivitiesPerSecond is the throttling limit for activity tasks controlled by the server
117+ TaskListActivitiesPerSecond float64
113118
114119 // User can provide an identity for the debuggability. If not provided the framework has
115120 // a default option.
@@ -310,7 +315,7 @@ func newActivityTaskWorker(
310315 baseWorkerOptions {
311316 pollerCount : workerParams .ConcurrentPollRoutineSize ,
312317 maxConcurrentTask : workerParams .ConcurrentActivityExecutionSize ,
313- maxTaskPerSecond : workerParams .MaxActivityExecutionPerSecond ,
318+ maxTaskPerSecond : workerParams .WorkerActivitiesPerSecond ,
314319 taskWorker : poller ,
315320 identity : workerParams .Identity ,
316321 workerType : "ActivityWorker" ,
@@ -1010,14 +1015,15 @@ func newAggregatedWorker(
10101015 TaskList : taskList ,
10111016 ConcurrentPollRoutineSize : defaultConcurrentPollRoutineSize ,
10121017 ConcurrentActivityExecutionSize : wOptions .MaxConcurrentActivityExecutionSize ,
1013- MaxActivityExecutionPerSecond : wOptions .MaxActivityExecutionPerSecond ,
1018+ WorkerActivitiesPerSecond : wOptions .WorkerActivitiesPerSecond ,
10141019 Identity : wOptions .Identity ,
10151020 MetricsScope : wOptions .MetricsScope ,
10161021 Logger : wOptions .Logger ,
10171022 EnableLoggingInReplay : wOptions .EnableLoggingInReplay ,
10181023 UserContext : wOptions .BackgroundActivityContext ,
10191024 DisableStickyExecution : wOptions .DisableStickyExecution ,
10201025 StickyScheduleToStartTimeout : wOptions .StickyScheduleToStartTimeout ,
1026+ TaskListActivitiesPerSecond : wOptions .TaskListActivitiesPerSecond ,
10211027 }
10221028
10231029 ensureRequiredParams (& workerParams )
@@ -1264,8 +1270,11 @@ func fillWorkerOptionsDefaults(options WorkerOptions) WorkerOptions {
12641270 if options .MaxConcurrentActivityExecutionSize == 0 {
12651271 options .MaxConcurrentActivityExecutionSize = defaultMaxConcurrentActivityExecutionSize
12661272 }
1267- if options .MaxActivityExecutionPerSecond == 0 {
1268- options .MaxActivityExecutionPerSecond = defaultMaxActivityExecutionRate
1273+ if options .WorkerActivitiesPerSecond == 0 {
1274+ options .WorkerActivitiesPerSecond = _defaultWorkerActivitiesPerSecond
1275+ }
1276+ if options .TaskListActivitiesPerSecond == 0 {
1277+ options .TaskListActivitiesPerSecond = _defaultTaskListActivitiesPerSecond
12691278 }
12701279 if options .StickyScheduleToStartTimeout .Seconds () == 0 {
12711280 options .StickyScheduleToStartTimeout = stickyDecisionScheduleToStartTimeoutSeconds * time .Second
0 commit comments