Skip to content

Commit

Permalink
remove references to deleted sessions in the timers table
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed Dec 1, 2023
1 parent ce0dac3 commit 2b6e443
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ func (c *Client) DeleteSessions(startTimes []time.Time) error {
if err != nil {
return err
}

// Delete any associated timers
cur := tx.Bucket([]byte(timerBucket)).Cursor()
for k, v := cur.First(); k != nil; k, v = cur.Next() {
var t models.Timer
err := json.Unmarshal(v, &t)
if err != nil {
return err
}

if t.SessionKey.Equal(startTimes[i]) {
err = cur.Delete()
if err != nil {
return err
}
}
}
}

return nil
Expand Down

0 comments on commit 2b6e443

Please sign in to comment.