diff --git a/internal/owl/store.go b/internal/owl/store.go index 5816fe0f8..ebf8111fa 100644 --- a/internal/owl/store.go +++ b/internal/owl/store.go @@ -501,30 +501,34 @@ func (s *Store) Update(newOrUpdated, deleted []string) error { s.mu.Lock() defer s.mu.Unlock() - updateOpSet, err := NewOperationSet(WithOperation(UpdateSetOperation), WithSpecs(false)) - if err != nil { - return err - } + if len(newOrUpdated) > 0 { + updateOpSet, err := NewOperationSet(WithOperation(UpdateSetOperation), WithSpecs(false)) + if err != nil { + return err + } - err = updateOpSet.addEnvs("[execution]", newOrUpdated...) - if err != nil { - return err + err = updateOpSet.addEnvs("[execution]", newOrUpdated...) + if err != nil { + return err + } + + s.opSets = append(s.opSets, updateOpSet) } - s.opSets = append(s.opSets, updateOpSet) + if len(deleted) > 0 { + deleteOpSet, err := NewOperationSet(WithOperation(DeleteSetOperation), WithSpecs(false)) + if err != nil { + return err + } - deleteOpSet, err := NewOperationSet(WithOperation(DeleteSetOperation), WithSpecs(false)) - if err != nil { - return err - } + err = deleteOpSet.addEnvs("[execution]", deleted...) + if err != nil { + return err + } - err = deleteOpSet.addEnvs("[execution]", deleted...) - if err != nil { - return err + s.opSets = append(s.opSets, deleteOpSet) } - s.opSets = append(s.opSets, deleteOpSet) - // s.logger.Debug("opSets size", zap.Int("size", len(s.opSets))) return nil