Skip to content

Commit

Permalink
Add extra logging to PrioritizedThrottledTaskRunnerTests
Browse files Browse the repository at this point in the history
This should help debugging elastic#92910 and rule out possible enviromental
issues, such us slowness creating threads due to an overloaded CI
worker.
  • Loading branch information
fcofdez committed Jan 23, 2023
1 parent 21c8a56 commit 9ca87a5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,14 @@ private int getRandomPriority() {
}

private void assertNoRunningTasks(PrioritizedThrottledTaskRunner<TestTask> taskRunner) {
logger.info("--> ensure that there are no running tasks in the executor");
final var barrier = new CyclicBarrier(maxThreads + 1);
for (int i = 0; i < maxThreads; i++) {
executor.execute(() -> awaitBarrier(barrier));
executor.execute(() -> {
logger.info("--> await until barrier is released");
awaitBarrier(barrier);
logger.info("--> the barrier is released");
});
}
awaitBarrier(barrier);
assertThat(taskRunner.runningTasks(), equalTo(0));
Expand Down

0 comments on commit 9ca87a5

Please sign in to comment.