紧急修复麦位
This commit is contained in:
parent
5339742f69
commit
096e37612e
@ -307,31 +307,34 @@ public class UserHeartbeatListener implements MessageListener {
|
||||
? checkedChannelState
|
||||
: agoraRoomStateService.getChannelState(roomProfile.getId());
|
||||
if (!channelState.querySuccess()) {
|
||||
log.warn("心跳刷新麦位跳过,声网查询失败 roomId={}, userId={}, response={}",
|
||||
log.warn("心跳刷新麦位声网查询失败,降级刷新业务麦位 roomId={}, userId={}, response={}",
|
||||
roomProfile.getId(), userProfile.getId(), channelState.getRawResponse());
|
||||
liveMicrophoneGateway.refreshNotActiveUser(roomProfile);
|
||||
refreshMicActiveTimeWithoutAgoraCheck(event, roomProfile, liveMicrophone);
|
||||
return;
|
||||
}
|
||||
|
||||
Long agoraUid = DataTypeUtils.toLong(userProfile.getAccount());
|
||||
if (!channelState.channelExist() || Objects.isNull(agoraUid)
|
||||
|| CollectionUtils.isEmpty(channelState.getBroadcasters())
|
||||
|| !channelState.getBroadcasters().contains(agoraUid)) {
|
||||
if (!isUserInAgoraChannel(channelState, userProfile)) {
|
||||
agoraMicStateCleanupService.cleanupUser(roomProfile.getId(), userProfile.getId(),
|
||||
"heartbeat agora broadcaster missing");
|
||||
"heartbeat agora user missing");
|
||||
return;
|
||||
}
|
||||
|
||||
refreshMicActiveTimeWithoutAgoraCheck(event, roomProfile, liveMicrophone);
|
||||
}
|
||||
|
||||
private void refreshMicActiveTimeWithoutAgoraCheck(UserHeartbeatEvent event,
|
||||
RoomProfileDTO roomProfile,
|
||||
LiveMicrophone liveMicrophone) {
|
||||
// 刷新活跃时间
|
||||
if (liveMicCacheService.checkLockMic(roomProfile.getId(), liveMicrophone.getMicIndex())) {
|
||||
event.setRetryRefreshMick(true);
|
||||
event.setReqTrackId("retry-" + IdWorkerUtils.getIdStr());
|
||||
userMqMessageService.sendUserHeartbeat(event);
|
||||
if (liveMicCacheService.checkLockMic(roomProfile.getId(), liveMicrophone.getMicIndex())) {
|
||||
event.setRetryRefreshMick(true);
|
||||
event.setReqTrackId("retry-" + IdWorkerUtils.getIdStr());
|
||||
userMqMessageService.sendUserHeartbeat(event);
|
||||
return;
|
||||
}
|
||||
|
||||
liveMicrophone.updateLastActivityTime();
|
||||
liveMicCacheService.goUp(roomProfile.getId(), liveMicrophone.getMicIndex(), liveMicrophone);
|
||||
|
||||
liveMicrophone.updateLastActivityTime();
|
||||
liveMicCacheService.goUp(roomProfile.getId(), liveMicrophone.getMicIndex(), liveMicrophone);
|
||||
liveMicrophoneGateway.refreshNotActiveUser(roomProfile);
|
||||
}
|
||||
|
||||
|
||||
@ -72,15 +72,21 @@ public class AgoraMicStateReconcileTask {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Long> broadcasterUids = new HashSet<>(state.getBroadcasters());
|
||||
Set<Long> channelUids = new HashSet<>();
|
||||
if (CollectionUtils.isNotEmpty(state.getBroadcasters())) {
|
||||
channelUids.addAll(state.getBroadcasters());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(state.getAudience())) {
|
||||
channelUids.addAll(state.getAudience());
|
||||
}
|
||||
for (LiveMicrophone microphone : microphones) {
|
||||
if (Objects.isNull(microphone) || Objects.isNull(microphone.getUser())) {
|
||||
continue;
|
||||
}
|
||||
Long agoraUid = DataTypeUtils.toLong(microphone.getUser().getAccount());
|
||||
if (Objects.isNull(agoraUid) || !broadcasterUids.contains(agoraUid)) {
|
||||
if (Objects.isNull(agoraUid) || !channelUids.contains(agoraUid)) {
|
||||
agoraMicStateCleanupService.cleanupUser(roomId, microphone.getUser().getId(),
|
||||
"reconcile agora broadcaster missing");
|
||||
"reconcile agora user missing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user