Road2Melon commented on code in PR #777:
URL: 
https://github.com/apache/incubator-seata-go/pull/777#discussion_r1996868691


##########
pkg/tm/global_transaction.go:
##########
@@ -71,6 +71,14 @@ func (g *GlobalTransactionManager) Begin(ctx 
context.Context, timeout time.Durat
 
 // Commit the global transaction.
 func (g *GlobalTransactionManager) Commit(ctx context.Context, gtr 
*GlobalTransaction) error {
+       if isTimeout(ctx) {

Review Comment:
   
好像不太合适,因为如果使用context.WithTimeout或者context.WithDeadline的话,第一种方式是在方法begin返回这个创建的子ctx,以及再往commitOrRollback以及commit等方法透传这个超时子context;第二种方式是将子ctx再作为根context的Value传递。
   
前者对于其他调用到这些方法的代码影响很大,而后者作为根context的Value本质上还是和直接设置timeInfo这个Value一样。所以我觉得没有必要设置超时的context。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to