Skip to content

Commit

Permalink
Merge branch version/0-46-0-RC1 to adopt changes from PR #3469
Browse files Browse the repository at this point in the history
  • Loading branch information
as-builds committed Sep 3, 2024
2 parents 8ccf4db + 1aedb1c commit bed566e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pkg/runtime/internal/envdef/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ func New() *Collection {
}

func (c *Collection) Load(path string) (*EnvironmentDefinition, error) {
if envDef, ok := c.raw.EnvDefs[path]; ok {
return envDef, nil
}

envDef, err := NewEnvironmentDefinition(filepath.Join(path, EnvironmentDefinitionFilename))
if err != nil {
return nil, errs.Wrap(err, "Failed to initialize environment definition")
Expand All @@ -44,14 +40,14 @@ func (c *Collection) Load(path string) (*EnvironmentDefinition, error) {
}

func (c *Collection) Unload(path string) error {
// Prevent concurrent reads and writes
c.mutex.Lock()
defer c.mutex.Unlock()

if _, ok := c.raw.EnvDefs[path]; !ok {
return errs.New("Environment definition not found for path: %s", path)
}

// Prevent concurrent writes
c.mutex.Lock()
defer c.mutex.Unlock()

delete(c.raw.EnvDefs, path)

return nil
Expand Down

0 comments on commit bed566e

Please sign in to comment.