Skip to content

Commit 979d8d6

Browse files
committed
feat(dtmsvr): add delay consumption support for msg mode transactions
- Add logic to allow delaying consumption by using a custom NextCronTime - In msg mode, return nil early when NextCronTime is set and after 3 seconds from current time
1 parent 9e484d1 commit 979d8d6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

dtmsvr/api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ func svcSubmit(t *TransGlobal) interface{} {
3939
} else if err != nil {
4040
return err
4141
}
42+
43+
// In msg mode, allow delaying consumption by using a custom NextCronTime
44+
if !t.WaitResult && t.TransType == "msg" && !t.NextCronTime.IsZero() && t.NextCronTime.After(time.Now().Add(3*time.Second)) {
45+
return nil
46+
}
47+
4248
return t.Process(branches)
4349
}
4450

0 commit comments

Comments
 (0)