refactor: 优化用户权限变更事件逻辑

This commit is contained in:
zhouhao
2025-09-27 12:08:25 +08:00
parent b478bbdffc
commit d4f01dcbc6
2 changed files with 6 additions and 1 deletions

View File

@@ -50,6 +50,11 @@ public class ClearUserAuthorizationCacheEvent extends DefaultAsyncEvent {
super.async(doOnEnabled(Mono.fromDirect(publisher).then()));
}
@Override
public synchronized void first(Publisher<?> publisher) {
super.first(doOnEnabled(Mono.fromDirect(publisher).then()));
}
public static ClearUserAuthorizationCacheEvent of(Collection<String> collection) {
ClearUserAuthorizationCacheEvent event = new ClearUserAuthorizationCacheEvent();
if (collection == null || collection.isEmpty()) {

View File

@@ -43,7 +43,7 @@ public class DefaultReactiveAuthenticationManager implements ReactiveAuthenticat
.getCache("user-auth")
.evictAll(event.getUserId())
.doOnError(err -> log.error(err.getMessage(), err))
.doOnSuccess(__ -> log.info("clear user {} authentication cache success", event.getUserId()));
.doOnSuccess(__ -> log.debug("clear user {} authentication cache success", event.getUserId()));
}
if (event.isAsync()) {
event.first(operator);