Skip to content

Commit 03cd9c2

Browse files
committed
Fix mutex issue when adding a alarm
1 parent 48f5aea commit 03cd9c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

storage/alarm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ func (storageHelper *Helper) GetAlarm(idx int, withWritePermission bool) (types.
5757
// AddAlarm adds a given alarm
5858
func (storageHelper *Helper) AddAlarm(alarm types.Alarm) ([]types.Alarm, error) {
5959
storageHelper.getMutex().Lock()
60-
defer storageHelper.getMutex().Unlock()
6160

6261
data, err := storageHelper.getStoredData()
6362
if err != nil {
63+
storageHelper.getMutex().Unlock()
6464
return []types.Alarm{}, err
6565
}
6666

0 commit comments

Comments
 (0)