Skip to content

Commit

Permalink
Poll devices in parallel (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline authored Aug 6, 2019
1 parent 332acb8 commit 420e0cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test_runner/src/main/kotlin/ftl/run/RunningDevices.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,7 @@ class RunningDevices(stopwatch: StopWatch, testExecutions: List<TestExecution>)

fun next(): RunningDevice? = devices.firstOrNull { it.complete.not() }

fun allRunning(): List<RunningDevice> = devices.filter { it.complete.not() }

fun allComplete(): Boolean = devices.all { it.complete }
}
5 changes: 3 additions & 2 deletions test_runner/src/main/kotlin/ftl/run/TestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ object TestRunner {
while (true) {
if (matrices.map[matrixId]?.update(refreshedMatrix) == true) updateMatrixFile(matrices, args)

val nextDevice = runningDevices.next() ?: return
nextDevice.poll(refreshedMatrix)
runningDevices.allRunning().forEach { nextDevice ->
nextDevice.poll(refreshedMatrix)
}

// Matrix has 0 or more devices (test executions)
if (runningDevices.allComplete()) {
Expand Down

0 comments on commit 420e0cd

Please sign in to comment.