Skip to content

Commit b4f03ee

Browse files
authored
Return error if workflow backoff timer is not fired (temporalio#7095)
## What changed? Return error from task executor if workflow back of timer is not fired. ## Why? To prevent outer layers to count no-op timers as fired. ## How did you test it? Existing unit test ## Potential risks No ## Is hotfix candidate? Yes
1 parent a5b3c01 commit b4f03ee

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

service/history/timer_queue_active_task_executor.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,13 @@ func (t *timerQueueActiveTaskExecutor) executeWorkflowBackoffTimerTask(
446446
if err != nil {
447447
return err
448448
}
449-
if mutableState == nil || !mutableState.IsWorkflowExecutionRunning() {
450-
return nil
449+
if mutableState == nil {
450+
release(nil)
451+
return consts.ErrWorkflowExecutionNotFound
452+
}
453+
if !mutableState.IsWorkflowExecutionRunning() {
454+
release(nil)
455+
return consts.ErrWorkflowCompleted
451456
}
452457

453458
// TODO: deprecated, remove below 3 metrics after v1.25
@@ -476,7 +481,8 @@ func (t *timerQueueActiveTaskExecutor) executeWorkflowBackoffTimerTask(
476481

477482
if mutableState.HadOrHasWorkflowTask() {
478483
// already has workflow task
479-
return nil
484+
release(nil)
485+
return errNoTimerFired
480486
}
481487

482488
// schedule first workflow task

service/history/timer_queue_active_task_executor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ func (s *timerQueueActiveTaskExecutorSuite) TestWorkflowBackoffTimer_Noop() {
13031303
s.mockExecutionMgr.EXPECT().GetWorkflowExecution(gomock.Any(), gomock.Any()).Return(&persistence.GetWorkflowExecutionResponse{State: persistenceMutableState}, nil)
13041304

13051305
resp := s.timerQueueActiveTaskExecutor.Execute(context.Background(), s.newTaskExecutable(timerTask))
1306-
s.NoError(resp.ExecutionErr)
1306+
s.ErrorIs(resp.ExecutionErr, errNoTimerFired)
13071307
}
13081308

13091309
func (s *timerQueueActiveTaskExecutorSuite) TestActivityRetryTimer_Fire() {

0 commit comments

Comments
 (0)