Skip to content

Commit

Permalink
Merge pull request #15035 from SimonRichardson/remove-typed-lease-error
Browse files Browse the repository at this point in the history
[JUJU-2413] Remove typed lease error
  • Loading branch information
anvial committed Jan 10, 2023
2 parents 42d17be + 028c327 commit c91985d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
10 changes: 0 additions & 10 deletions core/lease/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ const (
// ErrAborted indicates that the stop channel returned before the operation
// succeeded or failed.
ErrAborted = errors.ConstError("lease operation aborted")

// ErrDeadlineExceeded indicates if the underlying request was rejected
// because enqueuing exceeded the timeout.
ErrDeadlineExceeded = errors.ConstError("lease deadline exceeded")
)

// IsInvalid returns whether the specified error represents ErrInvalid
Expand Down Expand Up @@ -72,9 +68,3 @@ func IsAborted(err error) bool {
func IsNotHeld(err error) bool {
return errors.Cause(err) == ErrNotHeld
}

// IsDeadlineExceeded returns whether the specified error represents
// ErrDeadlineExceeded (even if it's wrapped).
func IsDeadlineExceeded(err error) bool {
return errors.Cause(err) == ErrDeadlineExceeded
}
18 changes: 0 additions & 18 deletions worker/lease/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,6 @@ func (manager *Manager) retryingClaim(claim claim) {
manager.logContext, claim.holderName, claim.leaseKey.Lease)
claim.respond(lease.ErrClaimDenied)

case lease.IsDeadlineExceeded(err):
// This can happen if we were unable to process the claim in a
// given time. We should just return the claim denied.
manager.config.Logger.Warningf("[%s] deadline exceeded while handling claim %q for %q",
manager.logContext, claim.leaseKey, claim.holderName)
claim.respond(lease.ErrClaimDenied)

default:
// Stop the main loop because we got an abnormal error
manager.catacomb.Kill(errors.Trace(err))
Expand Down Expand Up @@ -457,11 +450,6 @@ func (manager *Manager) retryingRevoke(revoke revoke) {
manager.logContext, err, maxRetries, revoke.leaseKey, revoke.holderName)
revoke.respond(err)

case lease.IsDeadlineExceeded(err):
manager.config.Logger.Warningf("[%s] deadline exceeded while handling revoke %q for %q",
manager.logContext, revoke.leaseKey, revoke.holderName)
revoke.respond(lease.ErrDeadlineExceeded)

default:
// Stop the main loop because we got an abnormal error
manager.catacomb.Kill(errors.Trace(err))
Expand Down Expand Up @@ -667,12 +655,6 @@ func isFatalClaimRetryError(act action, err error, count int) bool {
return false
case lease.IsInvalid(err):
return false
case lease.IsDeadlineExceeded(err):
// Extend action we want to retry if the count is less that the number
// of retries.
if act == extendAction && count < maxDeadlineRetries {
return false
}
}
return true
}
Expand Down

0 comments on commit c91985d

Please sign in to comment.