refactor(测试计划): lock超时时间优化

This commit is contained in:
fit2-zhao 2023-05-08 15:38:43 +08:00
parent 3dabfc81bd
commit 5738f16f66
1 changed files with 13 additions and 1 deletions

View File

@ -90,7 +90,19 @@ public class RedisTemplateService {
* 加锁
*/
public boolean lock(String key, String value) {
return redisTemplate.opsForValue().setIfAbsent(StringUtils.join(PRX, key), value, TIME_OUT, TimeUnit.SECONDS);
boolean hasReport = redisTemplate.opsForValue().setIfAbsent(
StringUtils.join(PRX, key),
value,
TIME_OUT,
TimeUnit.MINUTES);
if(!hasReport){
redisTemplate.opsForValue().setIfPresent(
StringUtils.join(PRX, key),
value,
TIME_OUT,
TimeUnit.MINUTES);
}
return hasReport;
}
public boolean hasReport(String key, String reportId) {