feat(trademark): 实现商标筛查功能并优化相关配置
- 新增商标筛查进度展示界面与交互逻辑 - 实现产品、品牌及平台跟卖许可的分项任务进度追踪 - 添加商标数据导出与任务重试、取消功能 - 调整Redis连接池配置以提升并发性能 - 禁用ChromeDriver预加载,改为按需启动以节省资源- 支持品牌商标远程筛查接口调用与结果解析 - 增加Hutool工具库依赖用于简化IO与Excel处理- 更新USPTO商标查询脚本实现自动化检测 - 修改Ruoyi后台Redis依赖版本并添加集群心跳配置- 切换本地开发环境API地址指向内网测试服务器
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.common.core.redis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Redis连接健康检查组件
|
||||
* 定期检测Redis连接状态,确保连接可用
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RedisHealthCheck {
|
||||
|
||||
@Autowired
|
||||
private RedisConnectionFactory redisConnectionFactory;
|
||||
|
||||
/**
|
||||
* 每5分钟检查一次Redis连接状态
|
||||
*/
|
||||
@Scheduled(fixedRate = 300000)
|
||||
public void checkRedisConnection() {
|
||||
try {
|
||||
if (redisConnectionFactory instanceof LettuceConnectionFactory) {
|
||||
LettuceConnectionFactory lettuceFactory = (LettuceConnectionFactory) redisConnectionFactory;
|
||||
|
||||
// 验证连接是否有效
|
||||
if (!lettuceFactory.getConnection().ping().equals("PONG")) {
|
||||
log.warn("Redis连接异常,尝试重新连接...");
|
||||
lettuceFactory.resetConnection();
|
||||
log.info("Redis连接已重置");
|
||||
} else {
|
||||
log.debug("Redis连接正常");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Redis连接检查失败: {}", e.getMessage());
|
||||
try {
|
||||
// 尝试重置连接
|
||||
((LettuceConnectionFactory) redisConnectionFactory).resetConnection();
|
||||
log.info("Redis连接已重置");
|
||||
} catch (Exception ex) {
|
||||
log.error("Redis连接重置失败: {}", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user