REQ-3578: 处理重复请求

This commit is contained in:
yanglin 2025-01-10 17:26:37 +08:00
parent ea697caf25
commit 933b9ec1da

View File

@ -71,7 +71,11 @@ public class RequestReplayService {
replay.setType(requestInfo.getReplayType());
replay.setHash(hash);
replay.setRequest(JSON.parseObject(JSON.toJSONString(requestInfo.getRequest())));
requestReplayDao.save(replay);
try {
requestReplayDao.save(replay);
} catch (Exception e) {
log.warn("save request error, requestInfo={}", requestInfo, e);
}
String key = buildKey(hash);
Duration timeout = Duration.ofSeconds(cfg.getRequestReplayWindowExpireTimeInSeconds());
Boolean success = redisTemplate.opsForValue().setIfAbsent(key, "", timeout);