Skip to content

Commit

Permalink
fix: fix global session timeout calculate (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
fatelei authored May 30, 2022
1 parent 9eff19f commit bf3b084
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion pkg/dt/distributed_transaction_manger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions pkg/dt/undolog/table_records.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pkg/dt/undolog/undo_log.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf3b084

Please sign in to comment.