From 677ffe07d2ac8dd9997e0a1ff0482096e6b31ee7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 Jan 2026 02:59:54 +0000 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=BB=A3=E7=A0=81=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E7=9A=84=E5=87=86=E7=A1=AE=E6=80=A7=E5=92=8C=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com> --- .../me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java | 2 ++ .../cp/api/impl/WxCpServiceGetMsgAuditAccessTokenTest.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java index ef77d1d13..d3d4a09a8 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java @@ -62,6 +62,8 @@ public class WxCpRedisConfigImpl implements WxCpConfigStorage { private volatile int msgAuditSdkRefCount; /** * 会话存档access token锁(本地锁,不支持分布式) + * 注意:此实现使用本地ReentrantLock,在多实例部署时无法保证跨JVM的同步 + * 建议在生产环境中自行实现分布式锁机制,或使用其他支持分布式的配置存储实现 */ private final Lock msgAuditAccessTokenLock = new ReentrantLock(); diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpServiceGetMsgAuditAccessTokenTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpServiceGetMsgAuditAccessTokenTest.java index fb3f443d7..7cbbab204 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpServiceGetMsgAuditAccessTokenTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpServiceGetMsgAuditAccessTokenTest.java @@ -141,7 +141,7 @@ public class WxCpServiceGetMsgAuditAccessTokenTest { throw new WxErrorException("会话存档secret未配置"); } - // 模拟HTTP请求失败,实际测试中应该返回缓存的token + // 返回缓存的token(用于测试缓存机制) return getWxCpConfigStorage().getMsgAuditAccessToken(); }