Просмотр исходного кода

Fix execution sorting if there's only one replica

If there's only one replica in the replica list, execution sorting
would not trigger, thus replica may appear with `COMPLETED` status even
though the last execution was not successful.
Sergiu Miclea 8 лет назад
Родитель
Сommit
10489e3cc5
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      src/sources/ReplicaSource.js

+ 5 - 0
src/sources/ReplicaSource.js

@@ -36,6 +36,11 @@ class ReplicaSourceUtils {
   }
   }
 
 
   static sortReplicas(replicas) {
   static sortReplicas(replicas) {
+    if (replicas.length === 1) {
+      ReplicaSourceUtils.sortExecutions(replicas[0].executions)
+      return
+    }
+
     replicas.sort((a, b) => {
     replicas.sort((a, b) => {
       ReplicaSourceUtils.sortExecutions(a.executions)
       ReplicaSourceUtils.sortExecutions(a.executions)
       ReplicaSourceUtils.sortExecutions(b.executions)
       ReplicaSourceUtils.sortExecutions(b.executions)