YongGoose commented on code in PR #7133: URL: https://github.com/apache/incubator-seata/pull/7133#discussion_r1957088495
########## server/src/main/java/org/apache/seata/server/coordinator/DefaultCoordinator.java: ########## @@ -631,6 +645,60 @@ private void committingSchedule(long delay) { delay, TimeUnit.MILLISECONDS); } + /** + * Handle rollbacked by scheduled. + */ + protected void handleRollbackedByScheduled() { + SessionCondition sessionCondition = new SessionCondition(rollbackedStatuses); + sessionCondition.setLazyLoadBranch(true); + List<GlobalSession> rollbackedSessions = + SessionHolder.getRootSessionManager().findGlobalSessions(sessionCondition); + if (CollectionUtils.isEmpty(rollbackedSessions)) { + rollbackedSchedule(RETRY_DEAD_THRESHOLD); + return; + } + long delay = ROLLBACKED_RETRY_PERIOD; + rollbackedSessions.sort(Comparator.comparingLong(GlobalSession::getBeginTime)); + List<GlobalSession> needDoRollbackedSessions = new ArrayList<>(); + for (GlobalSession rollbackedSession : rollbackedSessions) { + long time = rollbackedSession.timeToDeadSession(); + if (time <= 0) { + needDoRollbackedSessions.add(rollbackedSession); + } else { + delay = Math.max(time, ROLLBACKED_RETRY_PERIOD); + break; + } + } + long now = System.currentTimeMillis(); + SessionHelper.forEach(needDoRollbackedSessions, rollbackedSession -> { + try { + if (isRetryTimeout(now, MAX_ROLLBACK_RETRY_TIMEOUT, rollbackedSession.getBeginTime())) { + + // commit retry timeout event + SessionHelper.endRollbackFailed(rollbackedSession, true, true); + + //The function of this 'return' is 'continue'. + return; + } + core.doGlobalRollback(rollbackedSession, true); Review Comment: Done in https://github.com/apache/incubator-seata/pull/7133/commits/a7a9e5255b8f235758e9397ef29872f2386735d0 ! -- 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