-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WxOpenComponentServiceImpl高并发情况下有不停刷新access_token的风险 #1300
Comments
同样如果大量线程同时进入了如下去微信获取access_token的方法,那么一样会雪崩 |
我也遇到了,在使用获取authorizer_access_token 接口调用令牌的时候,我对appid加锁,同appid进入的请求串行,不同appid的并行,在使用WxJava之前 进行一个过滤了 |
重写了两个方法解决,第一个是从微信获取access_token,另外一个是去expireAccessToken,对每个方法加锁,双重检查
|
@007gzs 如果有时间的话,能否帮忙看下? |
开放平台的处理方式目前和mp是一致的,理论上mp请求也会有这个问题 |
getComponentAccessToken 里应该做下加锁的处理,我看下 |
楼主提供了加锁实现的解决方案,看起来可行 |
3.7.6.B已修复 |
`private String get(String uri, String accessTokenKey) throws WxErrorException {
String componentAccessToken = this.getComponentAccessToken(false);
String uriWithComponentAccessToken = uri + (uri.contains("?") ? "&" : "?") + accessTokenKey + "=" + componentAccessToken;
当access_token过期的时候,如果大量请求同时进入到 this.getWxOpenConfigStorage().expireComponentAccessToken();这行代码,会导致刚刚刷新的access_token被过期,相当于是并发情况下释放了非自己的锁
The text was updated successfully, but these errors were encountered: