Skip to content

Commit 36ffada

Browse files
authored
Merge pull request #52 from gopalmor/master
Avoid blocking if promotables channel is full.
2 parents b779edb + 36d03ce commit 36ffada

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cache.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ func (c *Cache) bucket(key string) *bucket {
206206
}
207207

208208
func (c *Cache) promote(item *Item) {
209-
c.promotables <- item
209+
select {
210+
case c.promotables <- item:
211+
default:
212+
}
213+
210214
}
211215

212216
func (c *Cache) worker() {

0 commit comments

Comments
 (0)