Skip to content

Commit

Permalink
Fix mutex issue when adding a alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
bb4L committed Jul 4, 2021
1 parent 48f5aea commit 03cd9c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage/alarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ func (storageHelper *Helper) GetAlarm(idx int, withWritePermission bool) (types.
// AddAlarm adds a given alarm
func (storageHelper *Helper) AddAlarm(alarm types.Alarm) ([]types.Alarm, error) {
storageHelper.getMutex().Lock()
defer storageHelper.getMutex().Unlock()

data, err := storageHelper.getStoredData()
if err != nil {
storageHelper.getMutex().Unlock()
return []types.Alarm{}, err
}

Expand Down

0 comments on commit 03cd9c2

Please sign in to comment.