@@ -256,6 +256,20 @@ export interface WorkerOptions {
256
256
*/
257
257
maxConcurrentWorkflowTaskExecutions ?: number ;
258
258
259
+ /**
260
+ * `maxConcurrentWorkflowTaskPolls` * this number = the number of max pollers that will
261
+ * be allowed for the nonsticky queue when sticky tasks are enabled. If both defaults are used,
262
+ * the sticky queue will allow 8 max pollers while the nonsticky queue will allow 2. The
263
+ * minimum for either poller is 1, so if `maxConcurrentWorkflowTaskPolls` is 1 and sticky queues are
264
+ * enabled, there will be 2 concurrent polls.
265
+ *
266
+ * ⚠️ This API is experimental and may be removed in the future if the poll scaling algorithm changes.
267
+ *
268
+ * @experimental This API is experimental and may be removed in the future if the poll scaling algorithm changes.
269
+ * @default 0.2
270
+ */
271
+ nonStickyToStickyPollRatio ?: number ;
272
+
259
273
/**
260
274
* Maximum number of Workflow Tasks to poll concurrently.
261
275
*
@@ -514,6 +528,7 @@ export type WorkerOptionsWithDefaults = WorkerOptions &
514
528
| 'maxConcurrentWorkflowTaskExecutions'
515
529
| 'maxConcurrentWorkflowTaskPolls'
516
530
| 'maxConcurrentActivityTaskPolls'
531
+ | 'nonStickyToStickyPollRatio'
517
532
| 'enableNonLocalActivities'
518
533
| 'stickyQueueScheduleToStartTimeout'
519
534
| 'maxCachedWorkflows'
@@ -564,6 +579,9 @@ export interface ReplayWorkerOptions
564
579
| 'maxConcurrentActivityTaskExecutions'
565
580
| 'maxConcurrentLocalActivityExecutions'
566
581
| 'maxConcurrentWorkflowTaskExecutions'
582
+ | 'maxConcurrentActivityTaskPolls'
583
+ | 'maxConcurrentWorkflowTaskPolls'
584
+ | 'nonStickyToStickyPollRatio'
567
585
| 'maxHeartbeatThrottleInterval'
568
586
| 'defaultHeartbeatThrottleInterval'
569
587
| 'debugMode'
@@ -649,6 +667,7 @@ export function addDefaultWorkerOptions(options: WorkerOptions): WorkerOptionsWi
649
667
namespace,
650
668
reuseV8Context,
651
669
sinks,
670
+ nonStickyToStickyPollRatio,
652
671
...rest
653
672
} = options ;
654
673
const debugMode = options . debugMode || isSet ( process . env . TEMPORAL_DEBUG ) ;
@@ -686,6 +705,7 @@ export function addDefaultWorkerOptions(options: WorkerOptions): WorkerOptionsWi
686
705
reuseV8Context : reuseV8Context ?? false ,
687
706
debugMode : debugMode ?? false ,
688
707
interceptors : appendDefaultInterceptors ( { } ) ,
708
+ nonStickyToStickyPollRatio : nonStickyToStickyPollRatio ?? 0.2 ,
689
709
sinks : { ...defaultSinks ( ) , ...sinks } ,
690
710
...rest ,
691
711
maxConcurrentWorkflowTaskExecutions,
0 commit comments