From 81c05e4b8bb30405c0cb2858a028be9c3860dce7 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 3 Jan 2025 16:56:54 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=9B=86=E7=BE=A4]=20=E4=BF=AE=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/RedisRpcPlayServiceImpl.java | 8 +++---- .../redisMsg/service/RedisRpcServiceImpl.java | 22 ++++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcPlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcPlayServiceImpl.java index aaec2ad9..2e230e1c 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcPlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcPlayServiceImpl.java @@ -194,7 +194,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService { @Override public void playPush(Integer id, ErrorCallback callback) { RedisRpcRequest request = buildRequest("streamPush/play", id); - RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout()); + RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS); if (response == null) { callback.run(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg(), null); }else { @@ -210,7 +210,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService { @Override public StreamInfo playProxy(String serverId, int id) { RedisRpcRequest request = buildRequest("streamProxy/play", id); - RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout()); + RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS); if (response != null && response.getStatusCode() == ErrorCode.SUCCESS.getCode()) { return JSON.parseObject(response.getBody().toString(), StreamInfo.class); } @@ -220,7 +220,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService { @Override public void stopProxy(String serverId, int id) { RedisRpcRequest request = buildRequest("streamProxy/stop", id); - RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout()); + RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS); if (response != null && response.getStatusCode() == ErrorCode.SUCCESS.getCode()) { log.info("[rpc 拉流代理] 停止成功: id: {}", id); }else { @@ -231,7 +231,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService { @Override public DownloadFileInfo getRecordPlayUrl(String serverId, Integer recordId) { RedisRpcRequest request = buildRequest("cloudRecord/play", recordId); - RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout()); + RedisRpcResponse response = redisRpcConfig.request(request, userSetting.getPlayTimeout(), TimeUnit.SECONDS); if (response != null && response.getStatusCode() == ErrorCode.SUCCESS.getCode()) { return JSON.parseObject(response.getBody().toString(), DownloadFileInfo.class); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java index fb69f88f..0744ef89 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java @@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import java.util.concurrent.TimeUnit; + @Slf4j @Service public class RedisRpcServiceImpl implements IRedisRpcService { @@ -62,7 +64,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { @Override public SendRtpInfo getSendRtpItem(String callId) { RedisRpcRequest request = buildRequest("sendRtp/getSendRtpItem", callId); - RedisRpcResponse response = redisRpcConfig.request(request, 10); + RedisRpcResponse response = redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); if (response.getBody() == null) { return null; } @@ -74,7 +76,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { log.info("[请求其他WVP] 开始推流,wvp:{}, {}/{}", sendRtpItem.getServerId(), sendRtpItem.getApp(), sendRtpItem.getStream()); RedisRpcRequest request = buildRequest("sendRtp/startSendRtp", callId); request.setToId(sendRtpItem.getServerId()); - RedisRpcResponse response = redisRpcConfig.request(request, 10); + RedisRpcResponse response = redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); return JSON.parseObject(response.getBody().toString(), WVPResult.class); } @@ -88,7 +90,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { log.info("[请求其他WVP] 停止推流,wvp:{}, {}/{}", sendRtpItem.getServerId(), sendRtpItem.getApp(), sendRtpItem.getStream()); RedisRpcRequest request = buildRequest("sendRtp/stopSendRtp", callId); request.setToId(sendRtpItem.getServerId()); - RedisRpcResponse response = redisRpcConfig.request(request, 10); + RedisRpcResponse response = redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); return JSON.parseObject(response.getBody().toString(), WVPResult.class); } @@ -140,7 +142,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { hookSubscribe.removeSubscribe(hook); RedisRpcRequest request = buildRequest("streamPush/stopWaitePushStreamOnline", sendRtpItem); request.setToId(sendRtpItem.getServerId()); - redisRpcConfig.request(request, 10); + redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); } @Override @@ -152,7 +154,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { } RedisRpcRequest request = buildRequest("streamPush/rtpSendStopped", callId); request.setToId(sendRtpItem.getServerId()); - redisRpcConfig.request(request, 10); + redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); } @Override @@ -202,7 +204,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { streamInfoParam.setApp(app); streamInfoParam.setStream(stream); RedisRpcRequest request = buildRequest("streamPush/unPushStreamOnlineEvent", streamInfoParam); - redisRpcConfig.request(request, 10); + redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); } @Override @@ -211,7 +213,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { jsonObject.put("id", id); jsonObject.put("cycle", cycle); RedisRpcRequest request = buildRequest("device/subscribeCatalog", jsonObject); - redisRpcConfig.request(request, 10); + redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); } @Override @@ -221,14 +223,14 @@ public class RedisRpcServiceImpl implements IRedisRpcService { jsonObject.put("cycle", cycle); jsonObject.put("interval", cycle); RedisRpcRequest request = buildRequest("device/subscribeMobilePosition", jsonObject); - redisRpcConfig.request(request, 10); + redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); } @Override public boolean updatePlatform(String serverId, Platform platform) { RedisRpcRequest request = buildRequest("platform/update", platform); request.setToId(serverId); - RedisRpcResponse response = redisRpcConfig.request(request, 4); + RedisRpcResponse response = redisRpcConfig.request(request, 40, TimeUnit.MILLISECONDS); return Boolean.parseBoolean(response.getBody().toString()); } @@ -242,6 +244,6 @@ public class RedisRpcServiceImpl implements IRedisRpcService { if (serverId != null) { request.setToId(serverId); } - redisRpcConfig.request(request, 1); + redisRpcConfig.request(request, 10, TimeUnit.MILLISECONDS); } }