mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: filter non connected KMSs when getting less loaded
parent
aecb0095b3
commit
96440b9f26
|
@ -111,7 +111,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
lockAcquired = true;
|
lockAcquired = true;
|
||||||
Kms lessLoadedKms = null;
|
Kms lessLoadedKms = null;
|
||||||
try {
|
try {
|
||||||
lessLoadedKms = this.kmsManager.getLessLoadedAndRunningKms();
|
lessLoadedKms = this.kmsManager.getLessLoadedConnectedAndRunningKms();
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
// Restore session not active
|
// Restore session not active
|
||||||
this.cleanCollections(sessionId);
|
this.cleanCollections(sessionId);
|
||||||
|
|
|
@ -102,9 +102,9 @@ public abstract class KmsManager {
|
||||||
return this.kmss.remove(kmsId);
|
return this.kmss.remove(kmsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Kms getLessLoadedAndRunningKms() throws NoSuchElementException {
|
public synchronized Kms getLessLoadedConnectedAndRunningKms() throws NoSuchElementException {
|
||||||
List<KmsLoad> kmsLoads = getKmsLoads().stream()
|
List<KmsLoad> kmsLoads = getKmsLoads().stream().filter(kmsLoad -> kmsLoad.kms.isKurentoClientConnected()
|
||||||
.filter(kmsLoad -> mediaNodeStatusManager.isRunning(kmsLoad.kms.getId())).collect(Collectors.toList());
|
&& mediaNodeStatusManager.isRunning(kmsLoad.kms.getId())).collect(Collectors.toList());
|
||||||
return Collections.min(kmsLoads).kms;
|
return Collections.min(kmsLoads).kms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,8 @@ public abstract class KmsManager {
|
||||||
@Override
|
@Override
|
||||||
public void connected() {
|
public void connected() {
|
||||||
final Kms kms = kmss.get(kmsId);
|
final Kms kms = kmss.get(kmsId);
|
||||||
// TODO: This should be done here instead of after KurentoClient.create method returns
|
// TODO: This should be done here instead of after KurentoClient.create method
|
||||||
|
// returns
|
||||||
// kms.setKurentoClientConnected(true);
|
// kms.setKurentoClientConnected(true);
|
||||||
// kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
|
// kms.setTimeOfKurentoClientConnection(System.currentTimeMillis());
|
||||||
log.info("Kurento Client is now connected to KMS {} with uri {}", kmsId, kms.getUri());
|
log.info("Kurento Client is now connected to KMS {} with uri {}", kmsId, kms.getUri());
|
||||||
|
|
|
@ -629,7 +629,7 @@ public class RecordingManager {
|
||||||
log.warn("No KMSs were defined in kms.uris array. Recording path check aborted");
|
log.warn("No KMSs were defined in kms.uris array. Recording path check aborted");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
MediaPipeline pipeline = this.kmsManager.getLessLoadedAndRunningKms().getKurentoClient()
|
MediaPipeline pipeline = this.kmsManager.getLessLoadedConnectedAndRunningKms().getKurentoClient()
|
||||||
.createMediaPipeline();
|
.createMediaPipeline();
|
||||||
RecorderEndpoint recorder = new RecorderEndpoint.Builder(pipeline, "file://" + testFilePath).build();
|
RecorderEndpoint recorder = new RecorderEndpoint.Builder(pipeline, "file://" + testFilePath).build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue