diff --git a/core/services/workflows/engine.go b/core/services/workflows/engine.go index ed5daaf2106..a5fb9a25ea7 100644 --- a/core/services/workflows/engine.go +++ b/core/services/workflows/engine.go @@ -333,7 +333,7 @@ func (e *Engine) registerTrigger(ctx context.Context, t *triggerCapability, trig return err } - t.config = tc + t.config.Store(tc) triggerRegRequest := capabilities.CapabilityRequest{ Metadata: capabilities.RequestMetadata{ @@ -343,7 +343,7 @@ func (e *Engine) registerTrigger(ctx context.Context, t *triggerCapability, trig WorkflowName: e.workflow.name, WorkflowOwner: e.workflow.owner, }, - Config: tc, + Config: t.config.Load(), Inputs: triggerInputs, } eventsCh, err := t.trigger.RegisterTrigger(ctx, triggerRegRequest) @@ -788,7 +788,7 @@ func (e *Engine) deregisterTrigger(ctx context.Context, t *triggerCapability, tr WorkflowOwner: e.workflow.owner, }, Inputs: triggerInputs, - Config: t.config, + Config: t.config.Load(), } // if t.trigger == nil, then we haven't initialized the workflow diff --git a/core/services/workflows/models.go b/core/services/workflows/models.go index 8d970dfa94f..1ff77225c4b 100644 --- a/core/services/workflows/models.go +++ b/core/services/workflows/models.go @@ -3,6 +3,7 @@ package workflows import ( "errors" "fmt" + "sync/atomic" "github.com/dominikbraun/graph" @@ -86,7 +87,8 @@ type step struct { type triggerCapability struct { workflows.StepDefinition trigger capabilities.TriggerCapability - config *values.Map + + config atomic.Pointer[values.Map] } func Parse(yamlWorkflow string) (*workflow, error) {