Commit 1dd270eb authored by 赵啸非's avatar 赵啸非

修正redis 最大连接数

parent 6a4f9e61
...@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ILogService; import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.impl.FileLogServiceImpl; import com.mortals.framework.service.impl.FileLogServiceImpl;
...@@ -65,17 +66,14 @@ public class TestSendMsgController { ...@@ -65,17 +66,14 @@ public class TestSendMsgController {
} }
@GetMapping("updateDevice") @GetMapping("updateDevice")
public String updateDevice() { public Rest<Void> updateDevice() {
log.info("刷新设备的产品编码");
ApiResp<DeviceResp> rsp = new ApiResp<>();
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
List<DeviceEntity> updateProductCodeList = deviceService.find(new DeviceQuery()); List<DeviceEntity> updateProductCodeList = deviceService.find(new DeviceQuery());
for (DeviceEntity deviceEntity : updateProductCodeList) { for (DeviceEntity deviceEntity : updateProductCodeList) {
deviceService.update(deviceEntity); deviceService.update(deviceEntity);
} }
return JSON.toJSONString(rsp); return Rest.ok();
} }
......
...@@ -45,6 +45,7 @@ public final class Constant { ...@@ -45,6 +45,7 @@ public final class Constant {
public static final String DES_STR = "FZV1D&tr"; public static final String DES_STR = "FZV1D&tr";
public static final Integer SERVER_PORT = 28074; public static final Integer SERVER_PORT = 28074;
public static Integer SEND_INTEVEL = 1000;
public static final Integer CLIENT_PORT = 28073; public static final Integer CLIENT_PORT = 28073;
/** /**
* 设备心跳检查时间(秒) * 设备心跳检查时间(秒)
......
...@@ -16,6 +16,7 @@ import org.springframework.stereotype.Component; ...@@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_IN_HTTP_URL; import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_IN_HTTP_URL;
import static com.mortals.xhx.common.key.Constant.SEND_INTEVEL;
import static com.mortals.xhx.common.key.RedisKey.KEY_DEVICE_THIRDPARTY_QUEUE; import static com.mortals.xhx.common.key.RedisKey.KEY_DEVICE_THIRDPARTY_QUEUE;
@Component @Component
...@@ -41,7 +42,7 @@ public class DeviceSendThirdPartyService implements IApplicationStartedService { ...@@ -41,7 +42,7 @@ public class DeviceSendThirdPartyService implements IApplicationStartedService {
log.info("初始化发送线程数量"); log.info("初始化发送线程数量");
//启动短信发送响应更新线程 //启动短信发送响应更新线程
sendTaskThreadPool.execute(() -> { sendTaskThreadPool.execute(() -> {
int waitTime = 1000; int waitTime = SEND_INTEVEL;
while (!stopped) { while (!stopped) {
try { try {
DeviceReq deviceReq = cacheService.lpop(KEY_DEVICE_THIRDPARTY_QUEUE, DeviceReq.class); DeviceReq deviceReq = cacheService.lpop(KEY_DEVICE_THIRDPARTY_QUEUE, DeviceReq.class);
...@@ -51,10 +52,10 @@ public class DeviceSendThirdPartyService implements IApplicationStartedService { ...@@ -51,10 +52,10 @@ public class DeviceSendThirdPartyService implements IApplicationStartedService {
log.info("sendThirty resp ==>{}", JSON.toJSONString(resp)); log.info("sendThirty resp ==>{}", JSON.toJSONString(resp));
} }
try { // try {
Thread.sleep(waitTime); // Thread.sleep(waitTime);
} catch (InterruptedException e2) { // } catch (InterruptedException e2) {
} // }
} catch (Exception e) { } catch (Exception e) {
log.error("异常", e); log.error("异常", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment