From f9be43731d8f2374a18f6aaad20378e7f2854ea3 Mon Sep 17 00:00:00 2001 From: johnniang Date: Fri, 10 May 2019 15:26:06 +0800 Subject: [PATCH] Remove Async annotation on event listeners --- .../run/halo/app/event/comment/CommentEventListener.java | 8 +++++++- .../event/freemarker/FreemarkerConfigAwareListener.java | 4 ---- .../run/halo/app/event/theme/ThemeUpdatedListener.java | 2 -- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/run/halo/app/event/comment/CommentEventListener.java b/src/main/java/run/halo/app/event/comment/CommentEventListener.java index a576f93f5..f7d0a73a5 100644 --- a/src/main/java/run/halo/app/event/comment/CommentEventListener.java +++ b/src/main/java/run/halo/app/event/comment/CommentEventListener.java @@ -74,6 +74,8 @@ public class CommentEventListener { // Get postComment id PostComment postComment = postCommentService.getById(newEvent.getCommentId()); + log.debug("Got post comment: [{}]", postComment); + Post post = postService.getById(postComment.getPostId()); StrBuilder url = new StrBuilder(optionService.getBlogBaseUrl()) @@ -86,6 +88,8 @@ public class CommentEventListener { } else if (newEvent.getSource() instanceof SheetService) { SheetComment sheetComment = sheetCommentService.getById(newEvent.getCommentId()); + log.debug("Got sheet comment: [{}]", sheetComment); + Sheet sheet = sheetService.getById(sheetComment.getPostId()); StrBuilder url = new StrBuilder(optionService.getBlogBaseUrl()) @@ -98,6 +102,8 @@ public class CommentEventListener { } else if (newEvent.getSource() instanceof JournalService) { JournalComment journalComment = journalCommentService.getById(newEvent.getCommentId()); + log.debug("Got journal comment: [{}]", journalComment); + Journal journal = journalService.getById(journalComment.getPostId()); StrBuilder url = new StrBuilder(optionService.getBlogBaseUrl()) @@ -133,7 +139,7 @@ public class CommentEventListener { Map data = new HashMap<>(); - log.debug("replyEvent.getSource():"+replyEvent.getSource().toString()); + log.debug("replyEvent.getSource():" + replyEvent.getSource().toString()); if (replyEvent.getSource() instanceof PostCommentService) { diff --git a/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java b/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java index d3e470888..358395251 100644 --- a/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java +++ b/src/main/java/run/halo/app/event/freemarker/FreemarkerConfigAwareListener.java @@ -49,7 +49,6 @@ public class FreemarkerConfigAwareListener { this.userService = userService; } - @Async @EventListener @Order(Ordered.HIGHEST_PRECEDENCE + 1) public void onApplicationStartedEvent(ApplicationStartedEvent applicationStartedEvent) throws TemplateModelException { @@ -60,7 +59,6 @@ public class FreemarkerConfigAwareListener { loadUserConfig(); } - @Async @EventListener public void onThemeActivatedEvent(ThemeActivatedEvent themeActivatedEvent) throws TemplateModelException { log.debug("Received theme activated event"); @@ -68,7 +66,6 @@ public class FreemarkerConfigAwareListener { loadThemeConfig(); } - @Async @EventListener public void onUserUpdate(UserUpdatedEvent event) throws TemplateModelException { log.debug("Received user updated event, user id: [{}]", event.getUserId()); @@ -76,7 +73,6 @@ public class FreemarkerConfigAwareListener { loadUserConfig(); } - @Async @EventListener public void onOptionUpdate(OptionUpdatedEvent event) throws TemplateModelException { log.debug("Received option updated event"); diff --git a/src/main/java/run/halo/app/event/theme/ThemeUpdatedListener.java b/src/main/java/run/halo/app/event/theme/ThemeUpdatedListener.java index 9a7f86108..0cb624680 100644 --- a/src/main/java/run/halo/app/event/theme/ThemeUpdatedListener.java +++ b/src/main/java/run/halo/app/event/theme/ThemeUpdatedListener.java @@ -22,13 +22,11 @@ public class ThemeUpdatedListener { this.cacheStore = cacheStore; } - @Async @EventListener public void onApplicationEvent(ThemeUpdatedEvent event) { cacheStore.delete(ThemeService.THEMES_CACHE_KEY); } - @Async @EventListener public void onOptionUpdatedEvent(OptionUpdatedEvent optionUpdatedEvent) { cacheStore.delete(ThemeService.THEMES_CACHE_KEY);