Index: filter/dscache/ds.go |
diff --git a/filter/dscache/ds.go b/filter/dscache/ds.go |
index 542ada6b111cf2335a76602acdf94e10addec238..b466d46e3c2782e17ff4ab5bf3022ba8e9904808 100644 |
--- a/filter/dscache/ds.go |
+++ b/filter/dscache/ds.go |
@@ -9,6 +9,7 @@ import ( |
ds "github.com/luci/gae/service/datastore" |
"github.com/luci/gae/service/memcache" |
+ "github.com/luci/luci-go/common/errors" |
log "github.com/luci/luci-go/common/logging" |
"golang.org/x/net/context" |
) |
@@ -44,7 +45,7 @@ func (d *dsCache) GetMulti(keys []*ds.Key, metas ds.MultiMetaGetter, cb ds.GetMu |
// (so, not an issue), or because memcache is having sad times (in which |
// case we'll see so in the GetMulti which immediately follows this). |
} |
- if err := d.mc.GetMulti(lockItems); err != nil { |
+ if err := filterMCErr(d.mc.GetMulti(lockItems)); err != nil { |
(log.Fields{log.ErrorKey: err}).Warningf( |
d.c, "dscache: GetMulti: memcache.GetMulti") |
} |
@@ -139,3 +140,14 @@ func (d *dsCache) RunInTransaction(f func(context.Context) error, opts *ds.Trans |
} |
return err |
} |
+ |
+// filterMCErr filters expected memcache failure errors from the supplied err. |
+// If err is composed exclusively of expected failure errors, filterMCErr will |
+// return nil |
+// |
+// The following error types are filtered: |
+// - ErrCacheMiss: memcache is permitted to evict cache items at its |
+// discretion. |
+func filterMCErr(err error) error { |
iannucci
2016/02/13 00:16:44
inline this sucka!
|
+ return errors.Filter(err, memcache.ErrCacheMiss) |
+} |