diff --git a/pkg/dt/distributed_transaction_manger.go b/pkg/dt/distributed_transaction_manger.go index e0ee3c8f..aabfedc9 100644 --- a/pkg/dt/distributed_transaction_manger.go +++ b/pkg/dt/distributed_transaction_manger.go @@ -231,7 +231,13 @@ func (manager *DistributedTransactionManager) processGlobalSessions() error { return err } } - manager.globalSessionQueue.AddAfter(gs, time.Duration(misc.CurrentTimeMillis()-uint64(gs.BeginTime))*time.Millisecond) + + delayAt := uint64(gs.Timeout) - (misc.CurrentTimeMillis() - uint64(gs.BeginTime)) + if delayAt > 0 { + manager.globalSessionQueue.AddAfter(gs, time.Duration(delayAt)) + } else { + manager.globalSessionQueue.Add(gs) + } } if gs.Status == api.Committing || gs.Status == api.Rollbacking { bsKeys, err := manager.storageDriver.GetBranchSessionKeys(context.Background(), gs.XID) diff --git a/pkg/dt/undolog/table_records.pb.go b/pkg/dt/undolog/table_records.pb.go index d09b9be1..5ab8a99a 100644 --- a/pkg/dt/undolog/table_records.pb.go +++ b/pkg/dt/undolog/table_records.pb.go @@ -22,10 +22,11 @@ package undolog import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/pkg/dt/undolog/undo_log.pb.go b/pkg/dt/undolog/undo_log.pb.go index 7041be63..a3e28a9b 100644 --- a/pkg/dt/undolog/undo_log.pb.go +++ b/pkg/dt/undolog/undo_log.pb.go @@ -22,10 +22,11 @@ package undolog import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const (