Skip to content

Commit

Permalink
fix(rollback): compare returned time before calculating duration
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgw committed Feb 23, 2024
1 parent 1ab35fd commit 27d82d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/exchanger/direct_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ func (ex *Exchanger) isIBTPRollbackForDirect(ibtp *pb.IBTP) bool {
ex.logger.Infof("[isIBTPRollbackForDirect] ibtp.Type: %s, startTimeStamp: %d, timeoutPeriod: %d, "+
"txStatus: %v, for IBTP [%s], time.Now().Unix(): %d", ibtp.Type.String(), startTimeStamp, timeoutPeriod,
txStatus, ibtp.ID(), time.Now().Unix())

return uint64(time.Now().Unix())-startTimeStamp > timeoutPeriod
if uint64(time.Now().Unix()) > startTimeStamp {
return uint64(time.Now().Unix())-startTimeStamp > timeoutPeriod
}
return false
}

func (ex *Exchanger) rollbackIBTPForDirect(ibtp *pb.IBTP) {
Expand Down

0 comments on commit 27d82d5

Please sign in to comment.