mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: filter quarantined nodes when getting less loaded one
parent
96c4d8bd16
commit
ae071a4629
|
@ -91,7 +91,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
|
|
||||||
Kms lessLoadedKms = null;
|
Kms lessLoadedKms = null;
|
||||||
try {
|
try {
|
||||||
lessLoadedKms = this.kmsManager.getLessLoadedKms();
|
lessLoadedKms = this.kmsManager.getLessLoadedAndNoQuarantinedKms();
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
// Restore session not active
|
// Restore session not active
|
||||||
this.cleanCollections(sessionId);
|
this.cleanCollections(sessionId);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
@ -99,6 +100,12 @@ public abstract class KmsManager {
|
||||||
return Collections.min(getKmsLoads()).kms;
|
return Collections.min(getKmsLoads()).kms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized Kms getLessLoadedAndNoQuarantinedKms() throws NoSuchElementException {
|
||||||
|
List<KmsLoad> kmsLoads = getKmsLoads().stream().filter(kmsLoad -> !kmsLoad.kms.isQuarantined())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return Collections.min(kmsLoads).kms;
|
||||||
|
}
|
||||||
|
|
||||||
public Kms getKms(String kmsId) {
|
public Kms getKms(String kmsId) {
|
||||||
return this.kmss.get(kmsId);
|
return this.kmss.get(kmsId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue