Skip to content

Commit

Permalink
IWF-233: Override WorkerOptions default values (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski authored Nov 1, 2024
1 parent 2d339d2 commit bcb1d8c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
17 changes: 13 additions & 4 deletions service/interpreter/cadence/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,22 @@ func (iw *InterpreterWorker) Close() {

func (iw *InterpreterWorker) Start() {
config := env.GetSharedConfig()
options := worker.Options{
MaxConcurrentActivityTaskPollers: 10,
MaxConcurrentDecisionTaskPollers: 10,
}
var options worker.Options

if config.Interpreter.Cadence != nil && config.Interpreter.Cadence.WorkerOptions != nil {
options = *config.Interpreter.Cadence.WorkerOptions
}

// override default
if options.MaxConcurrentActivityTaskPollers == 0 {
options.MaxConcurrentActivityTaskPollers = 10
}

// override default
if options.MaxConcurrentDecisionTaskPollers == 0 {
options.MaxConcurrentDecisionTaskPollers = 10
}

iw.worker = worker.New(iw.service, iw.domain, iw.tasklist, options)
worker.EnableVerboseLogging(config.Interpreter.VerboseDebug)

Expand Down
21 changes: 15 additions & 6 deletions service/interpreter/temporal/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,24 @@ func (iw *InterpreterWorker) Close() {

func (iw *InterpreterWorker) Start() {
config := env.GetSharedConfig()
options := worker.Options{
MaxConcurrentActivityTaskPollers: 10,
// TODO: this cannot be too small otherwise the persistence_test for continueAsNew will fail, probably a bug in Temporal goSDK.
// It seems work as "parallelism" of something... need to report a bug ticket...
MaxConcurrentWorkflowTaskPollers: 10,
}
var options worker.Options

if config.Interpreter.Temporal != nil && config.Interpreter.Temporal.WorkerOptions != nil {
options = *config.Interpreter.Temporal.WorkerOptions
}

// override default
if options.MaxConcurrentActivityTaskPollers == 0 {
options.MaxConcurrentActivityTaskPollers = 10
}

// override default
if options.MaxConcurrentWorkflowTaskPollers == 0 {
// TODO: this cannot be too small otherwise the persistence_test for continueAsNew will fail, probably a bug in Temporal goSDK.
// It seems work as "parallelism" of something... need to report a bug ticket...
options.MaxConcurrentWorkflowTaskPollers = 10
}

iw.worker = worker.New(iw.temporalClient, iw.taskQueue, options)
worker.EnableVerboseLogging(config.Interpreter.VerboseDebug)

Expand Down

0 comments on commit bcb1d8c

Please sign in to comment.