Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Improve rate limit logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Oct 5, 2023
1 parent 4e1aa7b commit dcfd6bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crew/op_connect.go
Expand Up @@ -237,7 +237,8 @@ func (op *ConnectOp) setup(session *terminal.Session) {
if tErr := session.RateLimit(); tErr != nil {
// Fake connection error when rate limited.
if tErr.Is(terminal.ErrRateLimited) {
log.Debugf("spn/crew: op %s#%d is rate limited: %s", op.t.FmtID(), op.ID(), session.RateLimitInfo())
op.Stop(op, tErr.With(session.RateLimitInfo()))
return
}
op.Stop(op, tErr)
return
Expand Down
2 changes: 1 addition & 1 deletion terminal/operation.go
Expand Up @@ -239,7 +239,7 @@ func (t *TerminalBase) StopOperation(op Operation, err *Error) {
switch {
case err == nil:
log.Debugf("spn/terminal: operation %s %s stopped", op.Type(), fmtOperationID(t.parentID, t.id, op.ID()))
case err.IsOK() || err.Is(ErrTryAgainLater):
case err.IsOK(), err.Is(ErrTryAgainLater), err.Is(ErrRateLimited):
log.Debugf("spn/terminal: operation %s %s stopped: %s", op.Type(), fmtOperationID(t.parentID, t.id, op.ID()), err)
default:
log.Warningf("spn/terminal: operation %s %s failed: %s", op.Type(), fmtOperationID(t.parentID, t.id, op.ID()), err)
Expand Down

0 comments on commit dcfd6bc

Please sign in to comment.