Commit debcf8e2 by 墨竹

fix:标签同步增加限制

parent e2a06cea
......@@ -26,6 +26,7 @@ import com.gic.member.api.service.MemberTagService;
import com.gic.member.tag.api.dto.MemberTagItemDTO;
import com.gic.member.tag.api.service.MemberTagItemApiService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.QywxTagDTO;
import com.gic.wechat.api.dto.qywx.QywxTagGroupDTO;
import com.gic.wechat.api.dto.qywx.response.QywxGetCorpTagListDTO;
......@@ -36,6 +37,9 @@ import com.google.common.collect.Sets;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -551,6 +555,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("不需要操作:{},{}", wxUserId, externalUserId);
return;
}
RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("qywx:tag:limit");
rateLimiter.trySetRate(RateType.OVERALL, 5, 1, RateIntervalUnit.SECONDS);
rateLimiter.acquire();
QywxResponseDTO responseDTO = qywxUserApiService.markTag(wxEnterprise.getCorpid(), config.getWxSuiteid(), wxUserId, externalUserId, needSetTags, needDelTags);
logger.info("操作返回:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment