diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5095fe112..ebb1f45cc5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: check: name: Check & Publish runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 45 env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} steps: diff --git a/core/src/main/java/io/kestra/core/runners/Worker.java b/core/src/main/java/io/kestra/core/runners/Worker.java index 7d4f6e2bc4..85ec54c60c 100644 --- a/core/src/main/java/io/kestra/core/runners/Worker.java +++ b/core/src/main/java/io/kestra/core/runners/Worker.java @@ -73,11 +73,7 @@ public Worker(ApplicationContext applicationContext, int thread) { this.metricRegistry = applicationContext.getBean(MetricRegistry.class); ExecutorsUtils executorsUtils = applicationContext.getBean(ExecutorsUtils.class); - this.executors = executorsUtils.maxCachedThreadPool( - Math.min(Runtime.getRuntime().availableProcessors(), thread), - thread, - "worker" - ); + this.executors = executorsUtils.maxCachedThreadPool(thread,"worker"); } @Override diff --git a/core/src/main/java/io/kestra/core/utils/ExecutorsUtils.java b/core/src/main/java/io/kestra/core/utils/ExecutorsUtils.java index 60bc762e41..827cdea8f6 100644 --- a/core/src/main/java/io/kestra/core/utils/ExecutorsUtils.java +++ b/core/src/main/java/io/kestra/core/utils/ExecutorsUtils.java @@ -25,17 +25,21 @@ public ExecutorService cachedThreadPool(String name) { ); } - public ExecutorService maxCachedThreadPool(int minThread, int maxThread, String name) { + public ExecutorService maxCachedThreadPool(int maxThread, String name) { + ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( + maxThread, + maxThread, + 60L, + TimeUnit.SECONDS, + new LinkedBlockingQueue<>(), + threadFactoryBuilder.build(name + "_%d") + ); + + threadPoolExecutor.allowCoreThreadTimeOut(true); + return this.wrap( name, - new ThreadPoolExecutor( - minThread, - maxThread, - 60L, - TimeUnit.SECONDS, - new LinkedBlockingQueue<>(), - threadFactoryBuilder.build(name + "_%d") - ) + threadPoolExecutor ); }