Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1607)

Unified Diff: appengine/gaeauth/server/cache.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: more refactor Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/gaeauth/server/cache.go
diff --git a/appengine/gaeauth/server/cache.go b/appengine/gaeauth/server/cache.go
index 639d79e2fe6f9b25bc38e7f4e3fa89c5319c0490..5a66a9d91dd4b2b3509cc170dbf35e2673ef1c10 100644
--- a/appengine/gaeauth/server/cache.go
+++ b/appengine/gaeauth/server/cache.go
@@ -14,7 +14,7 @@ import (
"github.com/luci/luci-go/common/clock"
"github.com/luci/luci-go/common/data/caching/proccache"
- "github.com/luci/luci-go/common/errors"
+ "github.com/luci/luci-go/common/retry/transient"
"github.com/luci/luci-go/common/sync/mutexpool"
"github.com/luci/luci-go/server/auth"
)
@@ -40,7 +40,7 @@ func (m *Memcache) Get(c context.Context, key string) ([]byte, error) {
case err == mc.ErrCacheMiss:
return nil, nil
case err != nil:
- return nil, errors.WrapTransient(err)
+ return nil, transient.Tag.Apply(err)
default:
m.setLocal(c, key, itm.Value(), itm.Expiration())
return itm.Value(), nil
@@ -57,14 +57,14 @@ func (m *Memcache) Set(c context.Context, key string, value []byte, exp time.Dur
cc := m.cacheContext(c)
item := mc.NewItem(cc, key).SetValue(value).SetExpiration(exp)
if err := mc.Set(cc, item); err != nil {
- return errors.WrapTransient(err)
+ return transient.Tag.Apply(err)
}
return nil
}
// WithLocalMutex calls 'f' under local mutex.
-func (mc *Memcache) WithLocalMutex(c context.Context, key string, f func()) {
- mc.locks.WithMutex(key, f)
+func (m *Memcache) WithLocalMutex(c context.Context, key string, f func()) {
+ m.locks.WithMutex(key, f)
}
// cacheContext returns properly namespaced luci/gae context.

Powered by Google App Engine
This is Rietveld 408576698