Skip to content

Commit 9b9fab2

Browse files
committed
Fix: 解决生产环境新注册用户概率性未刷到lucene中的问题
1 parent 986d11b commit 9b9fab2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

upupor-web/src/main/java/com/upupor/web/aop/LuceneAspectAdvice.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public class LuceneAspectAdvice {
6565
abstractGetTargetIdList.add(new RadioHandler());
6666
}
6767

68+
private Object proceed;
69+
private UpuporLucene annotation;
6870
/**
6971
* 以 controller 包下定义的所有请求为切入点
7072
*/
@@ -74,7 +76,8 @@ public void upuporLuceneAspect() {
7476

7577
@Before("upuporLuceneAspect() && @annotation(annotation)")
7678
public void doBefore(JoinPoint joinPoint, UpuporLucene annotation) {
77-
System.out.println();
79+
this.proceed = null;
80+
this.annotation = null;
7881
}
7982

8083
/**
@@ -86,8 +89,13 @@ public void doBefore(JoinPoint joinPoint, UpuporLucene annotation) {
8689
*/
8790
@Around("upuporLuceneAspect() && @annotation(annotation)")
8891
public Object doAround(ProceedingJoinPoint proceedingJoinPoint, UpuporLucene annotation) throws Throwable {
89-
Object proceed = proceedingJoinPoint.proceed();
92+
this.proceed = proceedingJoinPoint.proceed();
93+
this.annotation = annotation;
94+
return proceed;
95+
}
9096

97+
@After("upuporLuceneAspect()")
98+
public void doAfter() {
9199
LuceneEvent luceneEvent = new LuceneEvent();
92100
luceneEvent.setDataType(annotation.dataType());
93101
luceneEvent.setOperationType(annotation.operationType());
@@ -105,13 +113,6 @@ public Object doAround(ProceedingJoinPoint proceedingJoinPoint, UpuporLucene ann
105113
if(StringUtils.isNotEmpty(luceneEvent.getTargetId())){
106114
publisher.publishEvent(luceneEvent);
107115
}
108-
109-
return proceed;
110-
}
111-
112-
@After("upuporLuceneAspect()")
113-
public void doAfter() {
114-
115116
}
116117

117118
}

0 commit comments

Comments
 (0)