Sfoglia il codice sorgente

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 anni fa
parent
commit
10489e3cc5
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      src/sources/ReplicaSource.js

+ 5 - 0
src/sources/ReplicaSource.js

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