Skip to content

Commit

Permalink
fix: reset value & err on refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
abihf committed Dec 8, 2021
1 parent 396e90b commit 3bae555
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ func (l *Loader) refetch(key interface{}, item *cacheItem) {
item.mutex.Lock()
defer item.mutex.Unlock()

item.value, item.err = value, err
if err != nil {
item.err = err
item.updateExpire(l.errTtl)
} else {
item.value = value
item.updateExpire(l.ttl)
}

Expand Down

0 comments on commit 3bae555

Please sign in to comment.