Commit 3ac5ed89 by 毛树良

fix:资源支持动态修改

1 parent 21644c07
...@@ -55,7 +55,13 @@ public class VAServerService { ...@@ -55,7 +55,13 @@ public class VAServerService {
public void registerVAServer(VaServerInfo vaServerInfo) { public void registerVAServer(VaServerInfo vaServerInfo) {
String devId = vaServerInfo.getDevID(); String devId = vaServerInfo.getDevID();
VaServerInfo vaServer = vaServerRedisRepository.getVAServerInfoById(devId); VaServerInfo vaServer = vaServerRedisRepository.getVAServerInfoById(devId);
Float availableResources = vaServer == null ? vaServerInfo.getVideoResource() : vaServer.getAvailableResources(); Float availableResources = null;
if (vaServer == null) {
availableResources = vaServerInfo.getVideoResource();
} else {
Float incrVal = vaServerInfo.getVideoResource() - vaServer.getVideoResource();
availableResources = vaServer.getAvailableResources() + incrVal;
}
vaServerInfo.setAvailableResources(availableResources); vaServerInfo.setAvailableResources(availableResources);
vaServerRedisRepository.addOrUpdate(devId, vaServerInfo); vaServerRedisRepository.addOrUpdate(devId, vaServerInfo);
keepalive(devId); keepalive(devId);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!