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

Unified Diff: appengine/gaeauth/server/internal/authdbimpl/authdb.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: copyright 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/internal/authdbimpl/authdb.go
diff --git a/appengine/gaeauth/server/internal/authdbimpl/authdb.go b/appengine/gaeauth/server/internal/authdbimpl/authdb.go
index ec0c0d740e2cfc814bf91b7f20c23c6e139275a0..9cf49cac763b4d956b46f31498fb36c8077c8183 100644
--- a/appengine/gaeauth/server/internal/authdbimpl/authdb.go
+++ b/appengine/gaeauth/server/internal/authdbimpl/authdb.go
@@ -16,6 +16,7 @@ import (
"github.com/luci/luci-go/common/clock"
"github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/common/retry"
"github.com/luci/luci-go/server/auth/service"
"github.com/luci/luci-go/server/auth/service/protocol"
)
@@ -74,7 +75,7 @@ func GetLatestSnapshotInfo(c context.Context) (*SnapshotInfo, error) {
return nil, nil
case err != nil:
report("ERROR_TRANSIENT")
- return nil, errors.WrapTransient(err)
+ return nil, retry.Tag.Apply(err)
default:
report("SUCCESS")
return &info, nil
@@ -103,7 +104,7 @@ func GetAuthDBSnapshot(c context.Context, id string) (*protocol.AuthDB, error) {
return nil, err // not transient
case err != nil:
report("ERROR_TRANSIENT")
- return nil, errors.WrapTransient(err)
+ return nil, retry.Tag.Apply(err)
}
db, err := service.InflateAuthDB(snap.AuthDBDeflated)
@@ -173,7 +174,7 @@ func ConfigureAuthService(c context.Context, baseURL, authServiceURL string) err
// It makes syncAuthDB fetch changes from `authServiceURL`, thus promoting
// `authServiceURL` to the status of main auth service.
if err := ds.Put(ds.WithoutTransaction(c), info); err != nil {
- return errors.WrapTransient(err)
+ return retry.Tag.Apply(err)
}
// Stop getting notifications from previously used auth service.
@@ -206,7 +207,7 @@ func fetchSnapshot(c context.Context, info *SnapshotInfo) error {
FetchedAt: clock.Now(c).UTC(),
}
logging.Infof(c, "Lag: %s", ent.FetchedAt.Sub(ent.CreatedAt))
- return errors.WrapTransient(ds.Put(ds.WithoutTransaction(c), &ent))
+ return retry.Tag.Apply(ds.Put(ds.WithoutTransaction(c), &ent))
}
// syncAuthDB fetches latest AuthDB snapshot from the configured auth service,
@@ -288,7 +289,7 @@ func syncAuthDB(c context.Context) (*SnapshotInfo, error) {
if err != nil {
report("ERROR_COMMITTING")
- return nil, errors.WrapTransient(err)
+ return nil, retry.Tag.Apply(err)
}
report("SUCCESS_UPDATED")

Powered by Google App Engine
This is Rietveld 408576698