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

Unified Diff: logdog/server/collector/coordinator/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: logdog/server/collector/coordinator/cache.go
diff --git a/logdog/server/collector/coordinator/cache.go b/logdog/server/collector/coordinator/cache.go
index 36c6ab8cb35c49bb84f9145ae0680a48c7dc8be3..928e52a7578685ad2beb4c140242ec07fe3309a3 100644
--- a/logdog/server/collector/coordinator/cache.go
+++ b/logdog/server/collector/coordinator/cache.go
@@ -10,8 +10,8 @@ import (
"github.com/luci/luci-go/common/clock"
"github.com/luci/luci-go/common/data/caching/lru"
- "github.com/luci/luci-go/common/errors"
log "github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/common/retry/transient"
"github.com/luci/luci-go/common/sync/promise"
"github.com/luci/luci-go/common/tsmon/field"
"github.com/luci/luci-go/common/tsmon/metric"
@@ -200,7 +200,7 @@ func (ce *cacheEntry) registerStream(ctx context.Context, coord Coordinator, st
// If the promise failed transiently, clear it so that subsequent callers
// will regenerate a new promise. ONLY clear it if it it is the same
// promise, as different callers may have already cleared/rengerated it.
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
ce.withLock(func() {
if ce.registerP == p {
ce.registerP = nil
@@ -267,7 +267,7 @@ func (ce *cacheEntry) terminateStream(ctx context.Context, coord Coordinator, tr
if _, err := p.Get(ctx); err != nil {
// If this is a transient error, delete this Promise so future termination
// attempts will retry for this stream.
- if errors.IsTransient(err) {
+ if transient.Tag.In(err) {
ce.withLock(func() {
if ce.terminateP == p {
ce.terminateP = nil

Powered by Google App Engine
This is Rietveld 408576698