From 4e878719d8a17c194595777f31346f6cd4170a28 Mon Sep 17 00:00:00 2001 From: conan8737 Date: Sun, 4 Jan 2026 17:28:12 +0800 Subject: [PATCH] fix: resolve unit test failures --- dtmsvr/trans_status.go | 5 ++++- dtmsvr/trans_type_workflow.go | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index 8cde388..a8d5e00 100644 --- a/dtmsvr/trans_status.go +++ b/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) diff --git a/dtmsvr/trans_type_workflow.go b/dtmsvr/trans_type_workflow.go index c79e7b4..d1de51c 100644 --- a/dtmsvr/trans_type_workflow.go +++ b/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)