Explorar el Código

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 hace 8 años
padre
commit
10489e3cc5
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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)