This is an automated email from the ASF dual-hosted git repository.

luky116 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 35343360 bugfix: fix return of Commit and Rollback (#595)
35343360 is described below

commit 35343360e4625fb2043e8e88237fdc2748d69bd5
Author: LuWeiQianYi <[email protected]>
AuthorDate: Sat Feb 3 17:46:09 2024 +0800

    bugfix: fix return of Commit and Rollback (#595)
    
    bugfix: commit or rollback success,but ctx error happens
---
 pkg/tm/global_transaction.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/tm/global_transaction.go b/pkg/tm/global_transaction.go
index 8ee554ee..efbe8a4a 100644
--- a/pkg/tm/global_transaction.go
+++ b/pkg/tm/global_transaction.go
@@ -98,7 +98,7 @@ func (g *GlobalTransactionManager) Commit(ctx 
context.Context, gtr *GlobalTransa
                bf.Wait()
        }
 
-       if bf.Err() != nil {
+       if err != nil || bf.Err() != nil {
                lastErr := errors.Wrap(err, bf.Err().Error())
                log.Warnf("send global commit request failed, xid %s, error 
%v", gtr.Xid, lastErr)
                return lastErr
@@ -140,7 +140,7 @@ func (g *GlobalTransactionManager) Rollback(ctx 
context.Context, gtr *GlobalTran
                bf.Wait()
        }
 
-       if bf.Err() != nil {
+       if err != nil && bf.Err() != nil {
                lastErr := errors.Wrap(err, bf.Err().Error())
                log.Errorf("GlobalRollbackRequest rollback failed, xid %s, 
error %v", gtr.Xid, lastErr)
                return lastErr


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to