下麦接口优化
(cherry picked from commit 91e958d0b9a885fc100e9985721fd67b7a31a97a)
This commit is contained in:
parent
49281d503a
commit
3485be5504
@ -7,6 +7,7 @@ import com.red.circle.component.mq.service.Action;
|
|||||||
import com.red.circle.component.mq.service.ConsumerMessage;
|
import com.red.circle.component.mq.service.ConsumerMessage;
|
||||||
import com.red.circle.component.mq.service.MessageListener;
|
import com.red.circle.component.mq.service.MessageListener;
|
||||||
import com.red.circle.component.redis.service.RedisService;
|
import com.red.circle.component.redis.service.RedisService;
|
||||||
|
import com.red.circle.framework.dto.ResultResponse;
|
||||||
import com.red.circle.live.app.dto.cmd.HeartbeatStatusEnum;
|
import com.red.circle.live.app.dto.cmd.HeartbeatStatusEnum;
|
||||||
import com.red.circle.live.domain.gateway.LiveMicrophoneGateway;
|
import com.red.circle.live.domain.gateway.LiveMicrophoneGateway;
|
||||||
import com.red.circle.live.domain.live.LiveMicrophone;
|
import com.red.circle.live.domain.live.LiveMicrophone;
|
||||||
|
|||||||
@ -134,10 +134,7 @@ public class LiveMicCacheServiceImpl implements LiveMicCacheService {
|
|||||||
.map(LiveMicrophone::getMicIndex)
|
.map(LiveMicrophone::getMicIndex)
|
||||||
.map(Objects::toString)
|
.map(Objects::toString)
|
||||||
.toArray(String[]::new);
|
.toArray(String[]::new);
|
||||||
|
|
||||||
log.info("清除不活跃的用户入参 = {} ", JSON.toJSONString(index));
|
|
||||||
Long size = redisService.hashDelete(LiveMicKey.SEAT.getKey(roomId), index);
|
Long size = redisService.hashDelete(LiveMicKey.SEAT.getKey(roomId), index);
|
||||||
log.info("清除不活跃的用户结果 = {} ", size);
|
|
||||||
|
|
||||||
return Objects.nonNull(size) && size > 0;
|
return Objects.nonNull(size) && size > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -214,10 +214,7 @@ public class LiveMicrophoneGatewayImpl implements LiveMicrophoneGateway {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void goDown(Long roomId, Integer micIndex, Long userId) {
|
public void goDown(Long roomId, Integer micIndex, Long userId) {
|
||||||
|
|
||||||
// RLock lock = redissonClient.getLock(roomId.toString()+micIndex.toString()+"room");
|
|
||||||
micOpsLock(roomId, micIndex);
|
micOpsLock(roomId, micIndex);
|
||||||
// lock.lock();
|
|
||||||
try {
|
try {
|
||||||
RoomProfileDTO roomProfile = roomManagerClient.getById(roomId).getBody();
|
RoomProfileDTO roomProfile = roomManagerClient.getById(roomId).getBody();
|
||||||
// 房间是否真实存在
|
// 房间是否真实存在
|
||||||
@ -235,7 +232,6 @@ public class LiveMicrophoneGatewayImpl implements LiveMicrophoneGateway {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
ResponseAssert.isTrue(RoomErrorCode.ROOM_MEMBER_IS_MAX,false);
|
ResponseAssert.isTrue(RoomErrorCode.ROOM_MEMBER_IS_MAX,false);
|
||||||
} finally {
|
} finally {
|
||||||
// lock.unlock();
|
|
||||||
micOpsUnlock(roomId, micIndex);
|
micOpsUnlock(roomId, micIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,8 +382,6 @@ public class LiveMicrophoneGatewayImpl implements LiveMicrophoneGateway {
|
|||||||
|
|
||||||
ResponseAssert.isTrue(LiveMicErrorCode.MIC_PERMISSIONS,
|
ResponseAssert.isTrue(LiveMicErrorCode.MIC_PERMISSIONS,
|
||||||
roles.checkHomeownerOrAdmin());
|
roles.checkHomeownerOrAdmin());
|
||||||
// ResponseAssert.isTrue(LiveMicErrorCode.MIC_PERMISSIONS,
|
|
||||||
// Objects.equals(roomProfile.getUserId(), opsUserId));
|
|
||||||
return roomProfile;
|
return roomProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +437,6 @@ public class LiveMicrophoneGatewayImpl implements LiveMicrophoneGateway {
|
|||||||
.setTimeId(IdWorkerUtils.getIdStr())
|
.setTimeId(IdWorkerUtils.getIdStr())
|
||||||
.setMics(liveMicrophone)
|
.setMics(liveMicrophone)
|
||||||
.cleanData();
|
.cleanData();
|
||||||
log.info("Mic user change notice, roomId={}, data={}", roomProfile.getId(), noticeRes);
|
|
||||||
ThreadPoolManager.getInstance().execute(() ->{
|
ThreadPoolManager.getInstance().execute(() ->{
|
||||||
imGroupClient.sendCustomMessage(
|
imGroupClient.sendCustomMessage(
|
||||||
roomProfile.getRoomAccount(),
|
roomProfile.getRoomAccount(),
|
||||||
|
|||||||
@ -117,7 +117,6 @@ public class RoomEnterCmdExe {
|
|||||||
String token = userAgoraTokenCacheService.getUserAgoraToken(cmd.getReqUserId(), cmd.getRoomId());
|
String token = userAgoraTokenCacheService.getUserAgoraToken(cmd.getReqUserId(), cmd.getRoomId());
|
||||||
if (Objects.isNull(token)) {
|
if (Objects.isNull(token)) {
|
||||||
token = trtcClient.createAgoraToken(cmd.getReqUserId(), cmd.getRoomId().toString()).getBody();
|
token = trtcClient.createAgoraToken(cmd.getReqUserId(), cmd.getRoomId().toString()).getBody();
|
||||||
log.warn("进房间token:{}", token);
|
|
||||||
userAgoraTokenCacheService.save(token, cmd.getReqUserId(), cmd.getRoomId());
|
userAgoraTokenCacheService.save(token, cmd.getReqUserId(), cmd.getRoomId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user