mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
Use a read Context when checking for callbacks to close (#8746)
When processing callbacks in mutable state use a read only context to validate there are callbacks to process, if there are get the writeable context to process the callbacks. ## What changed? Use a read context to check for callbacks ## Why? Removes a write of the root workflow component persisted / replicated upon close. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [X] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks NA, not rolled out for users yet
This commit is contained in:
@@ -6421,6 +6421,17 @@ func (ms *MutableStateImpl) processCloseCallbacksHsm() error {
|
||||
|
||||
// processCloseCallbacksChasm triggers "WorkflowClosed" callbacks using the CHASM implementation.
|
||||
func (ms *MutableStateImpl) processCloseCallbacksChasm() error {
|
||||
wf, _, err := ms.ChasmWorkflowComponentReadOnly(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Return early if there are no chasm callbacks to process.
|
||||
if len(wf.Callbacks) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If there are callbacks to process, create a writable workflow component.
|
||||
wf, ctx, err := ms.ChasmWorkflowComponent(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user