Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into jira/lwolczynski/IWF-232
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski committed Nov 1, 2024
2 parents 2ed8404 + bcb1d8c commit 7a888d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 42 deletions.
32 changes: 11 additions & 21 deletions service/interpreter/cadence/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ type InterpreterWorker struct {
tasklist string
}

type StartOptions struct {
// When DisableStickyCache is true it can harm performance; should not be used in production environment
DisableStickyCache bool
}

func NewInterpreterWorker(
config config.Config, service workflowserviceclient.Interface, domain, tasklist string, closeFunc func(),
unifiedClient uclient.UnifiedClient,
Expand All @@ -43,28 +38,23 @@ func (iw *InterpreterWorker) Close() {
}

func (iw *InterpreterWorker) Start() {
var options StartOptions

// default options
options.DisableStickyCache = false

iw.StartWithOptions(options)
}

func (iw *InterpreterWorker) StartWithOptions(startOptions StartOptions) {
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
}

if startOptions.DisableStickyCache {
options.DisableStickyExecution = true
// override default
if options.MaxConcurrentActivityTaskPollers == 0 {
options.MaxConcurrentActivityTaskPollers = 10
}

if config.Interpreter.Cadence != nil && config.Interpreter.Cadence.WorkerOptions != nil {
options = *config.Interpreter.Cadence.WorkerOptions
// 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
33 changes: 12 additions & 21 deletions service/interpreter/temporal/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ type InterpreterWorker struct {
taskQueue string
}

type StartOptions struct {
// When DisableStickyCache is true it can harm performance; should not be used in production environment
DisableStickyCache bool
}

func NewInterpreterWorker(
config config.Config, temporalClient client.Client, taskQueue string, memoEncryption bool,
memoEncryptionConverter converter.DataConverter, unifiedClient uclient.UnifiedClient,
Expand All @@ -41,27 +36,23 @@ func (iw *InterpreterWorker) Close() {
}

func (iw *InterpreterWorker) Start() {
var options StartOptions
config := env.GetSharedConfig()
var options worker.Options

// default options
options.DisableStickyCache = false
if config.Interpreter.Temporal != nil && config.Interpreter.Temporal.WorkerOptions != nil {
options = *config.Interpreter.Temporal.WorkerOptions
}

iw.StartWithOptions(options)
}
// override default
if options.MaxConcurrentActivityTaskPollers == 0 {
options.MaxConcurrentActivityTaskPollers = 10
}

func (iw *InterpreterWorker) StartWithOptions(startOptions StartOptions) {
config := env.GetSharedConfig()
options := worker.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...
MaxConcurrentWorkflowTaskPollers: 10,
}
if config.Interpreter.Temporal != nil && config.Interpreter.Temporal.WorkerOptions != nil {
options = *config.Interpreter.Temporal.WorkerOptions
}
if startOptions.DisableStickyCache {
worker.SetStickyWorkflowCacheSize(0)
options.MaxConcurrentWorkflowTaskPollers = 10
}

iw.worker = worker.New(iw.temporalClient, iw.taskQueue, options)
Expand Down

0 comments on commit 7a888d6

Please sign in to comment.