Skip to content

Commit

Permalink
fix(cache/aememcache): skip entity when gob encode & decode error occ…
Browse files Browse the repository at this point in the history
…ured
  • Loading branch information
vvakame committed Dec 7, 2017
1 parent d657928 commit 2c3f8da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cache/aememcache/aememcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ func (ch *CacheHandler) SetMulti(ctx context.Context, cis []*storagecache.CacheI
enc := gob.NewEncoder(&buf)
err := enc.Encode(ci.PropertyList)
if err != nil {
return err
ch.Logf(ctx, "cache/aememcache.SetMulti: gob.Encode error key=%s err=%s", ci.Key.String(), err.Error())
continue
}
itemList = append(itemList, &memcache.Item{
Key: ch.cacheKey(ci.Key),
Expand Down Expand Up @@ -156,7 +157,9 @@ func (ch *CacheHandler) GetMulti(ctx context.Context, keys []datastore.Key) ([]*
var ps datastore.PropertyList
err = dec.Decode(&ps)
if err != nil {
return nil, err
resultList[idx] = nil
ch.Logf(ctx, "cache/aememcache.GetMulti: gob.Decode error key=%s err=%s", key.String(), err.Error())
continue
}
resultList[idx] = &storagecache.CacheItem{
Key: key,
Expand Down

0 comments on commit 2c3f8da

Please sign in to comment.