Skip to content

Commit

Permalink
fix: replcae e.stopTimer() with make chan [bug]
Browse files Browse the repository at this point in the history
  • Loading branch information
shaj13 committed Jun 17, 2022
1 parent 971790b commit aca3e78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Entry struct {
// start/stop timer added for safety to prevent fire on expired callback,
// when entry re-stored at the expiry time.
func (e *Entry) startTimer(d time.Duration, f func(key, value interface{})) {
e.stopTimer() // Stop old timer if there
e.cancel = make(chan struct{})
e.timer = time.AfterFunc(d, func() {
select {
case <-e.cancel:
Expand Down

0 comments on commit aca3e78

Please sign in to comment.