Skip to content

Commit

Permalink
Merge pull request #74 from untangle/mfw-2339-save-confirmation-hangs
Browse files Browse the repository at this point in the history
MFW-2339 Move saveLocker lock and remove defer in favor of explict un…
  • Loading branch information
cblaise-untangle authored Oct 25, 2022
2 parents c8addcc + f83f7fa commit 41c23d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions services/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ func SetSettingsFile(segments []string, value interface{}, filename string, forc
if err != nil {
return createJSONErrorObject(err), err
}
saveLocker.Lock()
defer saveLocker.Unlock()

newSettings, err = setSettingsInJSON(jsonSettings, segments, value)
if err != nil {
Expand All @@ -164,7 +162,9 @@ func SetSettingsFile(segments []string, value interface{}, filename string, forc
return createJSONErrorObject(err), err
}

saveLocker.Lock()
output, err := syncAndSave(jsonSettings, filename, force)
saveLocker.Unlock()
if err != nil {
var errJSON map[string]interface{}
marshalErr := json.Unmarshal([]byte(err.Error()), &errJSON)
Expand Down

0 comments on commit 41c23d3

Please sign in to comment.