YongGoose commented on code in PR #7133:
URL: https://github.com/apache/incubator-seata/pull/7133#discussion_r1958986971


##########
server/src/main/java/org/apache/seata/server/session/GlobalSession.java:
##########
@@ -203,13 +211,33 @@ public boolean isTimeout() {
     }
 
     /**
-     * prevent could not handle committing and rollbacking transaction
+     * prevent could not handle committing, rollbacking and rollbacked 
transaction
+     *
+     * If the global session's status is in end status, it returns the 
remaining time until the session reaches
+     * the end state retry dead threshold.
+     * For other statuses, it returns the remaining time until the session 
reaches the retry dead threshold.
+     *
      * @return time to dead session. if not greater than 0, then deadSession
      */
     public long timeToDeadSession() {
+        if (isEndStatus()) {
+            return beginTime + END_STATE_RETRY_DEAD_THRESHOLD - 
System.currentTimeMillis();
+        }
         return beginTime + RETRY_DEAD_THRESHOLD - System.currentTimeMillis();
     }
 
+    private boolean isEndStatus() {
+        EnumSet<GlobalStatus> deadStatuses = EnumSet.of(
+            GlobalStatus.Rollbacked,
+            GlobalStatus.TimeoutRollbacked,
+            GlobalStatus.CommitFailed,
+            GlobalStatus.RollbackFailed,
+            GlobalStatus.TimeoutRollbackFailed,
+            GlobalStatus.Finished
+        );

Review Comment:
   No worries 😉
   I'll fix it.



-- 
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