From e6c7746c8a0c7e65d9e4b345035356ea6b1cd844 Mon Sep 17 00:00:00 2001 From: Yichao Yang Date: Thu, 1 Sep 2022 11:16:57 -0700 Subject: [PATCH] Improve host task schedule namespace change callback --- service/history/queues/scheduler.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/service/history/queues/scheduler.go b/service/history/queues/scheduler.go index 7e7180b7399..0928952acae 100644 --- a/service/history/queues/scheduler.go +++ b/service/history/queues/scheduler.go @@ -181,6 +181,18 @@ func (s *schedulerImpl) Start() { 0, func() {}, // no-op func(oldNamespaces, newNamespaces []*namespace.Namespace) { + namespaceFailover := false + for idx := range oldNamespaces { + if oldNamespaces[idx].FailoverVersion() != newNamespaces[idx].FailoverVersion() { + namespaceFailover = true + break + } + } + + if !namespaceFailover { + return + } + select { case s.channelWeightUpdateCh <- struct{}{}: default: