提交 322b22c7 作者: 沈振路

延时客服-finish

上级 8fea31c8
......@@ -12,7 +12,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @date 2022/9/15 18:13
*/
@SpringBootApplication
//@EnableScheduling
@EnableScheduling
@MapperScan("com.yaoyaozw.customer.mapper")
@EnableFeignClients
@EnableAsync
......
......@@ -124,7 +124,7 @@ public class SchedulingTask {
/**
* 从redis中更新人群包人数
*/
@Scheduled(cron = "0 0/15 * * * ?")
// @Scheduled(cron = "0 0/15 * * * ?")
public void updateCrowdPackageNumFromRedis() {
localLog.info("开始同步redis中人群包人数至数据库");
HashMap<String, Integer> entries = (HashMap<String, Integer>) redisTemplate.boundHashOps(CustomerCommonConstant.CROWD_HUMAN_NUN_REDIS_KEY).entries();
......
......@@ -4,7 +4,7 @@ spring:
application:
name: customer-service
profiles:
active: dev
active: pro
---
spring:
profiles: dev
......
import com.yaoyaozw.customer.CustomerServiceApplication;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.TimeUnit;
/**
* @author darker
* @date 2022/10/19 14:42
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CustomerServiceApplication.class)
public class Test {
@Autowired
private RedisTemplate redisTemplate;
@org.junit.Test
public void testRedis() {
redisTemplate.opsForValue().set("count", 0);
redisTemplate.expire("count", 1, TimeUnit.MINUTES);
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
redisTemplate.opsForValue().increment("count");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论