LingxinMeng 2 лет назад
Родитель
Сommit
ba26ff5035

+ 1 - 5
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/configuration/redis/CustomRedisClient.java

@@ -45,19 +45,15 @@ public class CustomRedisClient {
     /**
      * 加值
      */
-    public void increment(String key, long number) {
-        lock(key,1000,10000);
+    public  void increment(String key, long number) {
         stringRedisTemplate.opsForValue().increment(key, number);
-        unlock(key);
     }
 
     /**
      * 减值
      */
     public  void decrement(String key, long number) {
-        lock(key,1000,10000);
         stringRedisTemplate.opsForValue().decrement(key, number);
-        unlock(key);
     }
 
 

+ 2 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/util/ProjectUtil.java

@@ -540,7 +540,7 @@ public class ProjectUtil {
             final List<NodeModel> nodeList = kubernetesConfiguration.getGpuNodeList();
             for (NodeModel node : nodeList) {
                 if (nodeName.equals(node.getHostname())) {
-                    if (currentRestParallelism + 1 < node.getParallelism()) {
+                    if (currentRestParallelism + 1 <= node.getParallelism()) {
                         customRedisClient.increment(key, number);
                     }
                 }
@@ -553,7 +553,7 @@ public class ProjectUtil {
             final List<NodeModel> nodeList = kubernetesConfiguration.getCpuNodeList();
             for (NodeModel node : nodeList) {
                 if (nodeName.equals(node.getHostname())) {
-                    if (currentRestParallelism + 1 < node.getParallelism()) {
+                    if (currentRestParallelism + 1 <= node.getParallelism()) {
                         customRedisClient.increment(key, number);
                     }
                 }