Skip to content

Commit

Permalink
Replace utils.SeventhJitter with retryutils.SeventhJitter
Browse files Browse the repository at this point in the history
  • Loading branch information
espadolini committed Nov 12, 2024
1 parent 3f3b351 commit afdb59c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/backend/etcdbk/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ func New(ctx context.Context, params backend.Params, opts ...Option) (*EtcdBacke
closeCtx, cancel := context.WithCancel(ctx)

leaseCache, err := utils.NewFnCache(utils.FnCacheConfig{
TTL: utils.SeventhJitter(time.Minute * 2),
TTL: retryutils.SeventhJitter(time.Minute * 2),
Context: closeCtx,
Clock: options.clock,
ReloadOnErr: true,
CleanupInterval: utils.SeventhJitter(time.Minute * 2),
CleanupInterval: retryutils.SeventhJitter(time.Minute * 2),
})
if err != nil {
cancel()
Expand All @@ -289,7 +289,7 @@ func New(ctx context.Context, params backend.Params, opts ...Option) (*EtcdBacke
ctx: closeCtx,
watchDone: make(chan struct{}),
buf: buf,
leaseBucket: utils.SeventhJitter(options.leaseBucket),
leaseBucket: retryutils.SeventhJitter(options.leaseBucket),
leaseCache: leaseCache,
}

Expand Down
5 changes: 2 additions & 3 deletions lib/srv/heartbeatv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/gravitational/teleport/lib/inventory"
"github.com/gravitational/teleport/lib/inventory/metadata"
"github.com/gravitational/teleport/lib/services"
"github.com/gravitational/teleport/lib/utils"
"github.com/gravitational/teleport/lib/utils/interval"
)

Expand Down Expand Up @@ -360,7 +359,7 @@ func (h *HeartbeatV2) run() {
} else {
h.testEvent(hbv2FallbackErr)
// announce failed, enter a backoff state.
h.fallbackBackoffTime = time.Now().Add(utils.SeventhJitter(h.fallbackBackoff))
h.fallbackBackoffTime = time.Now().Add(retryutils.SeventhJitter(h.fallbackBackoff))
h.onHeartbeat(h.fallbackFailed)
}
} else {
Expand Down Expand Up @@ -418,7 +417,7 @@ func (h *HeartbeatV2) runWithSender(sender inventory.DownstreamSender) {
// can sometimes mean that the last announce failed "silently" from our perspective.
if t, ok := h.announce.LastTick(); ok {
elapsed := time.Since(t)
dai := utils.SeventhJitter(h.disruptionAnnounceInterval)
dai := retryutils.SeventhJitter(h.disruptionAnnounceInterval)
if elapsed >= dai {
h.shouldAnnounce = true
} else {
Expand Down
5 changes: 0 additions & 5 deletions lib/utils/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ import (
// Deprecated: use retryutils.HalfJitter.
func HalfJitter(d time.Duration) time.Duration { return retryutils.HalfJitter(d) }

// SeventhJitter is [retryutils.SeventhJitter].
//
// Deprecated: use retryutils.SeventhJitter.
func SeventhJitter(d time.Duration) time.Duration { return retryutils.SeventhJitter(d) }

// FullJitter is [retryutils.FullJitter].
//
// Deprecated: use retryutils.FullJitter.
Expand Down

0 comments on commit afdb59c

Please sign in to comment.