[集群] 修复BUG

dev/数据库统合
648540858 2025-01-03 16:56:54 +08:00
parent 000b797f48
commit 81c05e4b8b
2 changed files with 16 additions and 14 deletions

View File

@ -194,7 +194,7 @@ public class RedisRpcPlayServiceImpl implements IRedisRpcPlayService {
@Override
public void playPush(Integer id, ErrorCallback<StreamInfo> 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);
}

View File

@ -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);
}
}