Skip to content

Commit

Permalink
Fix scheduler NPE for timer failover processor (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt committed May 10, 2022
1 parent 668c851 commit 19972ae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions service/history/timerQueueActiveProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func newTimerQueueActiveProcessor(
func newTimerQueueFailoverProcessor(
shard shard.Context,
workflowCache workflow.Cache,
scheduler queues.Scheduler,
workflowDeleteManager workflow.DeleteManager,
namespaceIDs map[string]struct{},
standbyClusterName string,
Expand Down Expand Up @@ -202,7 +203,9 @@ func newTimerQueueFailoverProcessor(
matchingClient,
)

scheduler := newTimerTaskScheduler(shard, logger)
if scheduler == nil {
scheduler = newTimerTaskScheduler(shard, logger)
}

rescheduler := queues.NewRescheduler(
scheduler,
Expand All @@ -223,7 +226,7 @@ func newTimerQueueFailoverProcessor(
t,
timerTaskFilter,
taskExecutor,
nil,
scheduler,
rescheduler,
shard.GetTimeSource(),
logger,
Expand Down
1 change: 1 addition & 0 deletions service/history/timerQueueProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ func (t *timerQueueProcessorImpl) FailoverNamespace(
updateShardAckLevel, failoverTimerProcessor := newTimerQueueFailoverProcessor(
t.shard,
t.workflowCache,
t.scheduler,
t.workflowDeleteManager,
namespaceIDs,
standbyClusterName,
Expand Down
5 changes: 4 additions & 1 deletion service/history/transferQueueActiveProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func newTransferQueueActiveProcessor(
func newTransferQueueFailoverProcessor(
shard shard.Context,
workflowCache workflow.Cache,
scheduler queues.Scheduler,
archivalClient archiver.Client,
sdkClientFactory sdk.ClientFactory,
matchingClient matchingservice.MatchingServiceClient,
Expand Down Expand Up @@ -253,7 +254,9 @@ func newTransferQueueFailoverProcessor(
matchingClient,
)

scheduler := newTransferTaskScheduler(shard, logger)
if scheduler == nil {
scheduler = newTransferTaskScheduler(shard, logger)
}

rescheduler := queues.NewRescheduler(
scheduler,
Expand Down
1 change: 1 addition & 0 deletions service/history/transferQueueProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func (t *transferQueueProcessorImpl) FailoverNamespace(
updateShardAckLevel, failoverTaskProcessor := newTransferQueueFailoverProcessor(
t.shard,
t.workflowCache,
t.scheduler,
t.archivalClient,
t.sdkClientFactory,
t.matchingClient,
Expand Down

0 comments on commit 19972ae

Please sign in to comment.