Browse Source

fix: resolve unit test failures

pull/573/head
conan8737 3 months ago
parent
commit
4e878719d8
  1. 5
      dtmsvr/trans_status.go
  2. 6
      dtmsvr/trans_type_workflow.go

5
dtmsvr/trans_status.go

@ -233,7 +233,10 @@ func (t *TransGlobal) execBranch(ctx context.Context, branch *TransBranch, branc
}
branchMetrics(t, branch, status == dtmcli.StatusSucceed)
if err == dtmimp.ErrOngoing {
if err == nil && (time.Since(t.lastTouched)+NowForwardDuration >= 1500*time.Millisecond ||
t.NextCronInterval > conf.RetryInterval && t.NextCronInterval > t.RetryInterval) {
t.touchCronTime(cronReset, 0)
} else if err == dtmimp.ErrOngoing {
t.touchCronTime(cronKeep, 0)
} else if err != nil {
t.touchCronTime(cronBackoff, 0)

6
dtmsvr/trans_type_workflow.go

@ -3,7 +3,6 @@ package dtmsvr
import (
"context"
"math"
"time"
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
@ -44,10 +43,7 @@ func (t *transWorkflowProcessor) ProcessOnce(ctx context.Context, branches []Tra
}
err := t.getURLResult(ctx, t.QueryPrepared, "00", cmc.Name, data)
// if time pass 1500ms and NextCronInterval is not default, then reset NextCronInterval
if err == nil && (time.Since(t.lastTouched)+NowForwardDuration >= 1500*time.Millisecond ||
t.NextCronInterval > conf.RetryInterval && t.NextCronInterval > t.RetryInterval) {
t.touchCronTime(cronReset, 0)
} else if err == dtmimp.ErrOngoing {
if err == dtmimp.ErrOngoing {
t.touchCronTime(cronKeep, 0)
} else if err != nil {
t.touchCronTime(cronBackoff, 0)

Loading…
Cancel
Save