Skip to content

Commit

Permalink
Set default max eager activities to 3 (#946)
Browse files Browse the repository at this point in the history
Fixes #919
  • Loading branch information
cretz authored Nov 3, 2022
1 parent 66eb848 commit 97ed634
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions internal/internal_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ const (
// center. And the poll API latency is about 5ms. With 2 poller, we could achieve around 300~400 RPS.
defaultConcurrentPollRoutineSize = 2

defaultMaxConcurrentActivityExecutionSize = 1000 // Large concurrent activity execution size (1k)
defaultWorkerActivitiesPerSecond = 100000 // Large activity executions/sec (unlimited)
defaultMaxConcurrentActivityExecutionSize = 1000 // Large concurrent activity execution size (1k)
defaultMaxConcurrentEagerActivityExecutionSize = 3
defaultWorkerActivitiesPerSecond = 100000 // Large activity executions/sec (unlimited)

defaultMaxConcurrentLocalActivityExecutionSize = 1000 // Large concurrent activity execution size (1k)
defaultWorkerLocalActivitiesPerSecond = 100000 // Large activity executions/sec (unlimited)
Expand Down Expand Up @@ -1602,6 +1603,9 @@ func setWorkerOptionsDefaults(options *WorkerOptions) {
if options.MaxHeartbeatThrottleInterval == 0 {
options.MaxHeartbeatThrottleInterval = defaultMaxHeartbeatThrottleInterval
}
if options.MaxConcurrentEagerActivityExecutionSize == 0 {
options.MaxConcurrentEagerActivityExecutionSize = defaultMaxConcurrentEagerActivityExecutionSize
}
}

// setClientDefaults should be needed only in unit tests.
Expand Down
9 changes: 6 additions & 3 deletions internal/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ type (
// workflow task schedules 3 more, only the first 2 will request eager
// execution.
//
// The default of 0 means unlimited and therefore only bound by
// If unset/0, this defaults to 3. Users wanting effectively unlimited can
// set this to a high value. This is still bounded by
// MaxConcurrentActivityExecutionSize.
//
// See DisableEagerActivities for a description of eager activity execution.
Expand Down Expand Up @@ -256,8 +257,10 @@ func IsReplayNamespace(dn string) bool {

// NewWorker creates an instance of worker for managing workflow and activity executions.
// client - client created with client.Dial() or client.NewLazyClient().
// taskQueue - is the task queue name you use to identify your client worker, also
// identifies group of workflow and activity implementations that are hosted by a single worker process.
// taskQueue - is the task queue name you use to identify your client worker,
// also identifies group of workflow and activity implementations that are
// hosted by a single worker process.
//
// options - configure any worker specific options.
func NewWorker(
client Client,
Expand Down

0 comments on commit 97ed634

Please sign in to comment.