Skip to content

Commit aca3e78

Browse files
committed
fix: replcae e.stopTimer() with make chan [bug]
1 parent 971790b commit aca3e78

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Entry struct {
2828
// start/stop timer added for safety to prevent fire on expired callback,
2929
// when entry re-stored at the expiry time.
3030
func (e *Entry) startTimer(d time.Duration, f func(key, value interface{})) {
31-
e.stopTimer() // Stop old timer if there
31+
e.cancel = make(chan struct{})
3232
e.timer = time.AfterFunc(d, func() {
3333
select {
3434
case <-e.cancel:

0 commit comments

Comments
 (0)