From efe1163aedb871602bf7fe634fc018b037674f46 Mon Sep 17 00:00:00 2001 From: Asher Feldman Date: Tue, 17 Sep 2019 13:15:27 -0700 Subject: [PATCH] fix(core): run CancellableStage cancel method on dedicated thread pool (#3164) --- .../spinnaker/orca/config/OrcaConfiguration.java | 10 ++++++++++ .../spinnaker/orca/q/handler/CancelStageHandler.kt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/orca-core/src/main/java/com/netflix/spinnaker/orca/config/OrcaConfiguration.java b/orca-core/src/main/java/com/netflix/spinnaker/orca/config/OrcaConfiguration.java index 668dcc61ee..671b5c06ea 100644 --- a/orca-core/src/main/java/com/netflix/spinnaker/orca/config/OrcaConfiguration.java +++ b/orca-core/src/main/java/com/netflix/spinnaker/orca/config/OrcaConfiguration.java @@ -173,6 +173,16 @@ public ThreadPoolTaskExecutor applicationEventTaskExecutor() { return threadPool; } + @Bean + public ThreadPoolTaskExecutor cancellableStageExecutor() { + ThreadPoolTaskExecutor threadPool = new ThreadPoolTaskExecutor(); + threadPool.setThreadNamePrefix("cancel-"); + threadPool.setCorePoolSize(5); + threadPool.setMaxPoolSize(10); + threadPool.setQueueCapacity(20); + return threadPool; + } + @Bean public TaskScheduler taskScheduler() { ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); diff --git a/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandler.kt b/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandler.kt index 74eed4e9bf..0ff3286692 100644 --- a/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandler.kt +++ b/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandler.kt @@ -38,7 +38,7 @@ class CancelStageHandler( override val stageDefinitionBuilderFactory: StageDefinitionBuilderFactory, override val stageNavigator: StageNavigator, - @Qualifier("messageHandlerPool") private val executor: Executor, + @Qualifier("cancellableStageExecutor") private val executor: Executor, private val taskResolver: TaskResolver ) : OrcaMessageHandler, StageBuilderAware, AuthenticationAware {