From f7e46d204be81fd2ebb9e5a90728e945700a2c23 Mon Sep 17 00:00:00 2001
From: cl <1442464845@qq.com>
Date: 星期五, 17 四月 2026 17:27:10 +0800
Subject: [PATCH] 配置
---
rsf-http-audit/src/main/java/com/vincent/rsf/httpaudit/service/HttpAuditRuleServiceImpl.java | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/rsf-http-audit/src/main/java/com/vincent/rsf/httpaudit/service/HttpAuditRuleServiceImpl.java b/rsf-http-audit/src/main/java/com/vincent/rsf/httpaudit/service/HttpAuditRuleServiceImpl.java
index 9fb77a1..6fb558a 100644
--- a/rsf-http-audit/src/main/java/com/vincent/rsf/httpaudit/service/HttpAuditRuleServiceImpl.java
+++ b/rsf-http-audit/src/main/java/com/vincent/rsf/httpaudit/service/HttpAuditRuleServiceImpl.java
@@ -25,6 +25,7 @@
private final HttpAuditProperties props;
private final CopyOnWriteArrayList<HttpAuditRule> cache = new CopyOnWriteArrayList<>();
+ private volatile long lastRefreshAt = 0L;
public HttpAuditRuleServiceImpl(HttpAuditRuleMapper mapper, HttpAuditProperties props) {
this.baseMapper = mapper;
@@ -37,8 +38,14 @@
}
@Override
- @Scheduled(fixedDelayString = "${http-audit.rule-cache-refresh-ms:60000}")
+ @Scheduled(fixedDelay = 5000)
public void refreshCache() {
+ long now = System.currentTimeMillis();
+ long interval = Math.max(5000L, props.getRuleCacheRefreshMs());
+ if (now - lastRefreshAt < interval) {
+ return;
+ }
+ lastRefreshAt = now;
try {
List<HttpAuditRule> list = list(new LambdaQueryWrapper<HttpAuditRule>()
.eq(HttpAuditRule::getDeleted, 0)
--
Gitblit v1.9.1