Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IWF-233: Override WorkerOptions default values #474

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading