diff --git a/backend/src/main/java/com/openisle/service/NotificationService.java b/backend/src/main/java/com/openisle/service/NotificationService.java index 9ad4d9cdd..86335151b 100644 --- a/backend/src/main/java/com/openisle/service/NotificationService.java +++ b/backend/src/main/java/com/openisle/service/NotificationService.java @@ -10,7 +10,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.transaction.annotation.Transactional; - +import org.springframework.transaction.support.TransactionSynchronization; +import org.springframework.transaction.support.TransactionSynchronizationManager; import java.util.Map; import java.util.regex.Pattern; @@ -71,7 +72,7 @@ public class NotificationService { } n = notificationRepository.save(n); - notificationExecutor.execute(() -> { +// Runnable asyncTask = () -> { if (type == NotificationType.COMMENT_REPLY && user.getEmail() != null && post != null && comment != null) { String url = String.format("%s/posts/%d#comment-%d", websiteUrl, post.getId(), comment.getId()); emailSender.sendEmail(user.getEmail(), "有人回复了你", url); @@ -95,7 +96,18 @@ public class NotificationService { // } // } } - }); +// }; + +// if (TransactionSynchronizationManager.isSynchronizationActive()) { +// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { +// @Override +// public void afterCommit() { +// notificationExecutor.execute(asyncTask); +// } +// }); +// } else { +// notificationExecutor.execute(asyncTask); +// } return n; } diff --git a/frontend/src/components/CallbackPage.vue b/frontend/src/components/CallbackPage.vue index 764b15a11..8fe8461c4 100644 --- a/frontend/src/components/CallbackPage.vue +++ b/frontend/src/components/CallbackPage.vue @@ -22,6 +22,7 @@ export default { flex-direction: column; align-items: center; justify-content: center; + height: 100%; } .callback-page-text {