Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/store/cache/inmemory.go: Use maxInt instead of math.MaxInt64 #2268

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/store/cache/inmemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package storecache

import (
"context"
"math"
"reflect"
"sync"
"unsafe"
Expand All @@ -28,6 +27,8 @@ var (
}
)

const maxInt = int(^uint(0) >> 1)

type InMemoryIndexCache struct {
mtx sync.Mutex

Expand Down Expand Up @@ -161,7 +162,7 @@ func NewInMemoryIndexCacheWithConfig(logger log.Logger, reg prometheus.Registere

// Initialize LRU cache with a high size limit since we will manage evictions ourselves
// based on stored size using `RemoveOldest` method.
l, err := lru.NewLRU(math.MaxInt64, c.onEvict)
l, err := lru.NewLRU(maxInt, c.onEvict)
if err != nil {
return nil, err
}
Expand All @@ -171,7 +172,7 @@ func NewInMemoryIndexCacheWithConfig(logger log.Logger, reg prometheus.Registere
"msg", "created in-memory index cache",
"maxItemSizeBytes", c.maxItemSizeBytes,
"maxSizeBytes", c.maxSizeBytes,
"maxItems", "math.MaxInt64",
"maxItems", "maxInt",
)
return c, nil
}
Expand Down