Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt committed May 30, 2023
1 parent ba2bdf0 commit 6b6a999
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions service/history/queues/executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (e *executableImpl) Execute() (retErr error) {

func (e *executableImpl) HandleErr(err error) (retErr error) {
defer func() {
if retErr != consts.ErrResourceExhaustedBusyWorkflow {
if errors.Is(retErr, consts.ErrResourceExhaustedBusyWorkflow) {
// if err is due to workflow busy, do not take any latency related to this attempt into account
e.inMemoryNoUserLatency += e.scheduleLatency + e.attemptNoUserLatency
}
Expand Down Expand Up @@ -290,7 +290,7 @@ func (e *executableImpl) HandleErr(err error) (retErr error) {
return err
}

if err == consts.ErrResourceExhaustedBusyWorkflow {
if errors.Is(err, consts.ErrResourceExhaustedBusyWorkflow) {
e.taggedMetricsHandler.Counter(metrics.TaskWorkflowBusyCounter.GetMetricName()).Record(1)
return err
}
Expand Down Expand Up @@ -410,7 +410,7 @@ func (e *executableImpl) Nack(err error) {
if !submitted {
backoffDuration := e.backoffDuration(err, e.Attempt())
e.rescheduler.Add(e, e.timeSource.Now().Add(backoffDuration))
if err != consts.ErrResourceExhaustedBusyWorkflow {
if !errors.Is(err, consts.ErrResourceExhaustedBusyWorkflow) {
e.inMemoryNoUserLatency += backoffDuration
}
}
Expand Down Expand Up @@ -468,7 +468,7 @@ func (e *executableImpl) shouldResubmitOnNack(attempt int, err error) bool {
return false
}

if err != consts.ErrResourceExhaustedBusyWorkflow &&
if !errors.Is(err, consts.ErrResourceExhaustedBusyWorkflow) &&
common.IsResourceExhausted(err) &&
e.systemResourceExhaustedCount > resourceExhaustedResubmitMaxAttempts {
return false
Expand Down Expand Up @@ -507,7 +507,7 @@ func (e *executableImpl) backoffDuration(
}

backoffDuration := reschedulePolicy.ComputeNextDelay(0, attempt)
if err != consts.ErrResourceExhaustedBusyWorkflow && common.IsResourceExhausted(err) {
if !errors.Is(err, consts.ErrResourceExhaustedBusyWorkflow) && common.IsResourceExhausted(err) {
// try a different reschedule policy to slow down retry
// upon system resource exhausted error and pick the longer backoff duration
backoffDuration = util.Max(
Expand Down

0 comments on commit 6b6a999

Please sign in to comment.