Skip to content

Commit

Permalink
Merge pull request #111 from evanofslack/redis
Browse files Browse the repository at this point in the history
Downlevel other cache encoding error
  • Loading branch information
evanofslack authored Aug 5, 2023
2 parents cd1e576 + 13d42f3 commit 7376bca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
)

const (
cacheMissErr = "cache: key is missing"
decodeArrayErr = "msgpack: invalid code=8c decoding array length"
cacheMissErr = "cache: key is missing"
decodeArrayErr1 = "msgpack: invalid code=8c decoding array length"
decodeArrayErr2 = "msgpack: number of fields in array-encoded struct has changed"
)

type RDB struct {
Expand Down Expand Up @@ -148,8 +149,8 @@ func (cache *Cache) get(ctx context.Context, key string, item interface{}) error
cache.stats.incMisses()

// temporarily downlevel this error
} else if strings.Contains(err.Error(), decodeArrayErr) {
cache.logger.Warn().Ctx(ctx).Str("instance", cache.instance).Msg(decodeArrayErr)
} else if strings.Contains(err.Error(), decodeArrayErr1) || strings.Contains(err.Error(), decodeArrayErr2) {
cache.logger.Warn().Ctx(ctx).Str("instance", cache.instance).Msg(err.Error())
cache.stats.incErrors()

// or an actual error
Expand Down

0 comments on commit 7376bca

Please sign in to comment.