Browse Source

fix: fix user information cache refresh too frequently problem

linwenhua 2 years ago
parent
commit
a7def93d8f

+ 2 - 1
smsb-customer-manager-adapter/src/main/java/com/inspur/customer/web/controller/keyclaok/KeycloakController.java

@@ -63,8 +63,9 @@ public class KeycloakController {
         return Response.buildSuccess();
     }
 
-    @Scheduled(cron = "0/1 * * * * ?")
+    @Scheduled(cron = "* 0/10 * * * ?")
     public void askUserOppenId() {
+        log.info("update wechat openId");
         for (String userId : keycloakService.getUsersMap().keySet()) {
             String oppenId = iWeChatService.askUser(userId);
             if (!StringUtils.isEmpty(oppenId)) {

+ 0 - 6
smsb-customer-manager-app/src/main/java/com/inspur/customer/service/keycloak/KeycloakServiceImpl.java

@@ -54,12 +54,6 @@ public class KeycloakServiceImpl implements KeycloakService {
         log.info("users map cache clear:{}",LocalDateTime.now() );
     }
 
-    @Scheduled(cron = "* 0/10 * * * ?")
-    public void expiredCache(){
-        // 每隔10小时,清除缓存数据初始化一次
-        this.clearUserMapCache();
-    }
-
     /**
      * get users in role (xuzhou environment)
      * @param role role