From 6b6a999614e715b937f55edfae6e86149b384b3f Mon Sep 17 00:00:00 2001 From: Yichao Yang Date: Tue, 30 May 2023 12:04:08 -0700 Subject: [PATCH] fix lint --- service/history/queues/executable.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service/history/queues/executable.go b/service/history/queues/executable.go index 32f5c9ed905..b58042d59c9 100644 --- a/service/history/queues/executable.go +++ b/service/history/queues/executable.go @@ -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 } @@ -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 } @@ -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 } } @@ -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 @@ -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(