Skip to content

Commit

Permalink
Re-enable get before fetch in synced function
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jan 24, 2024
1 parent 7ea92bd commit 250193d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cache/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ func (c *Cache[K, V]) fetchAndSetSynced(ctx context.Context, key K) (*ttlcache.I
ii, err, _ := c.fetchSync.Do(string(key), func() (any, error) {
// there's always a chance a different thread completed a fetch before we got here
// so check again now that we have a lock for the key
/*item := c.cache.Get(key)
item := c.cache.Get(key)
if item != nil {
return item, nil

Check warning on line 69 in cache/generic.go

View check run for this annotation

Codecov / codecov/patch

cache/generic.go#L69

Added line #L69 was not covered by tests
}*/
}

return c.fetchAndSet(ctx, key)
})
Expand Down

0 comments on commit 250193d

Please sign in to comment.