单元测试添加锁.

This commit is contained in:
lijiahang
2024-05-16 13:36:57 +08:00
parent 77cf635eea
commit 9a7437e8db
19 changed files with 122 additions and 51 deletions

View File

@@ -1,6 +1,6 @@
package com.orion.visor.module.infra.task;
import com.orion.visor.framework.redis.core.utils.RedisLocks;
import com.orion.visor.framework.common.utils.LockerUtils;
import com.orion.visor.module.infra.service.TagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
@@ -34,7 +34,7 @@ public class TagAutoClearTask {
public void clear() {
log.info("TagAutoClearTask.clear start");
// 获取锁并清理
RedisLocks.tryLock(LOCK_KEY, tagService::clearUnusedTag);
LockerUtils.tryLock(LOCK_KEY, tagService::clearUnusedTag);
log.info("TagAutoClearTask.clear finish");
}

View File

@@ -21,6 +21,9 @@ spring:
host: 127.0.0.1
port: 16379
database: 0
redisson:
threads: 2
netty-threads: 2
mybatis-plus:
lazy-initialization: true