From 25d68722e3132ea6498353324d06bf7f7f7fcf35 Mon Sep 17 00:00:00 2001 From: zrlw Date: Thu, 6 Mar 2025 09:43:37 +0800 Subject: [PATCH] Optimized EagerThreadPoolExecutorTest by decreasing maximumPoolSize (#15205) --- .../support/eager/EagerThreadPoolExecutorTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java index 9c6afec620c..cf8b222634b 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java @@ -110,7 +110,8 @@ void testEagerThreadPoolFast() { String name = "eager-tf"; int queues = 5; int cores = 5; - int threads = 10; + // github actions usually run on 4 cores which could be determined by LoadStatusCheckerTest + int threads = 5; // alive 1 second long alive = 1000; @@ -127,7 +128,7 @@ void testEagerThreadPoolFast() { taskQueue.setExecutor(executor); CountDownLatch countDownLatch1 = new CountDownLatch(1); - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 5; i++) { executor.execute(() -> { try { countDownLatch1.await(); @@ -136,8 +137,8 @@ void testEagerThreadPoolFast() { } }); } - await().until(() -> executor.getPoolSize() == 10); - Assertions.assertEquals(10, executor.getActiveCount()); + await().until(() -> executor.getPoolSize() == 5); + Assertions.assertEquals(5, executor.getActiveCount()); CountDownLatch countDownLatch2 = new CountDownLatch(1); AtomicBoolean started = new AtomicBoolean(false); @@ -153,8 +154,8 @@ void testEagerThreadPoolFast() { } await().until(() -> executor.getQueue().size() == 5); - Assertions.assertEquals(10, executor.getActiveCount()); - Assertions.assertEquals(10, executor.getPoolSize()); + Assertions.assertEquals(5, executor.getActiveCount()); + Assertions.assertEquals(5, executor.getPoolSize()); Assertions.assertFalse(started.get()); countDownLatch1.countDown();