From bb4ec7f01d3e08febe10562e6b7c853a7d74ad0a Mon Sep 17 00:00:00 2001 From: Yichao Yang Date: Tue, 10 Jan 2023 15:28:01 -0800 Subject: [PATCH] Prioritize worker pool shutdown (#3795) --- common/tasks/fifo_scheduler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/tasks/fifo_scheduler.go b/common/tasks/fifo_scheduler.go index 9b640efd90c..19296d27b74 100644 --- a/common/tasks/fifo_scheduler.go +++ b/common/tasks/fifo_scheduler.go @@ -206,6 +206,12 @@ func (f *FIFOScheduler[T]) processTask( return } + select { + case <-shutdownCh: + return + default: + } + select { case task := <-f.tasksChan: f.executeTask(task)