@@ -220,6 +220,8 @@ public Builder setMaxConcurrentNexusExecutionSize(int maxConcurrentNexusExecutio
220
220
* it to less than 1 if needed. For example, set the number to 0.1 means you want your activity
221
221
* to be executed once every 10 seconds. This can be used to protect down stream services from
222
222
* flooding. The zero value of this uses the default value. Default is unlimited.
223
+ *
224
+ * <p>Setting this value to a non-zero value will disable eager execution for activities.
223
225
*/
224
226
public Builder setMaxTaskQueueActivitiesPerSecond (double maxTaskQueueActivitiesPerSecond ) {
225
227
this .maxTaskQueueActivitiesPerSecond = maxTaskQueueActivitiesPerSecond ;
@@ -373,7 +375,8 @@ public Builder setStickyQueueScheduleToStartTimeout(Duration timeout) {
373
375
* the workflow task back to this worker which is faster than non-eager which may be dispatched
374
376
* to a separate worker.
375
377
*
376
- * <p>Defaults to false, meaning that eager activity execution is permitted
378
+ * <p>Defaults to false, meaning that eager activity execution is permitted. Unless you set
379
+ * MaxTaskQueueActivitiesPerSecond, then eager execution is disabled.
377
380
*/
378
381
public Builder setDisableEagerExecution (boolean disableEagerExecution ) {
379
382
this .disableEagerExecution = disableEagerExecution ;
@@ -685,7 +688,7 @@ private WorkerOptions(
685
688
this .maxHeartbeatThrottleInterval = maxHeartbeatThrottleInterval ;
686
689
this .defaultHeartbeatThrottleInterval = defaultHeartbeatThrottleInterval ;
687
690
this .stickyQueueScheduleToStartTimeout = stickyQueueScheduleToStartTimeout ;
688
- this .disableEagerExecution = disableEagerExecution ;
691
+ this .disableEagerExecution = maxTaskQueueActivitiesPerSecond > 0 ? true : disableEagerExecution ;
689
692
this .useBuildIdForVersioning = useBuildIdForVersioning ;
690
693
this .buildId = buildId ;
691
694
this .stickyTaskQueueDrainTimeout = stickyTaskQueueDrainTimeout ;
0 commit comments