-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Prevent workflow task and activity task generation when workflow is paused #8687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go
Outdated
Show resolved
Hide resolved
| err = s.SdkClient().SignalWorkflow(ctx, workflowID, runID, s.testEndSignal, "signal to complete the workflow") | ||
| s.NoError(err) | ||
|
|
||
| time.Sleep(2 * time.Second) // wait 2 seconds to give enough time record the signal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the sleep required with the s.EventuallyWithT below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a failure in tests that needs to be fixed but lgtm
| } else { // if not we bypass activity task generation if eager start activity is requested. | ||
| bypassActivityTaskGeneration = eagerStartActivity | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: looks like the else part is a duplication of L509.
| // Create a transfer task to schedule a workflow task | ||
| if !mutableState.HasPendingWorkflowTask() { | ||
| // Create a transfer task to schedule a workflow task only if the workflow is in running status and there is no pending workflow task. | ||
| if !mutableState.HasPendingWorkflowTask() && mutableState.GetExecutionState().GetStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think workflow tasks scheduled on the task processing side goes through this code path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm.. maybe intercepting in the task generator is the better? Specifically in TaskGeneratorImpl.GenerateScheduleWorkflowTaskTasks().
What changed?
Why?
When a workflow is paused, we should not generate any more new activity and workflow tasks.
How did you test it?
Note
Prevents scheduling new workflow and activity tasks while a workflow is paused and adds functional tests covering pause/unpause behavior with activities and child workflows.
service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.gobypassTaskGenerationto skip activity task creation wheneagerStartActivityor workflow status isWORKFLOW_EXECUTION_STATUS_PAUSED.service/history/api/update_workflow_util.goWORKFLOW_EXECUTION_STATUS_RUNNING.tests/pause_workflow_execution_test.goPAUSEDafter activity completion and after receiving a signal; verify it completes afterUNPAUSE.Written by Cursor Bugbot for commit 25a4b89. This will update automatically on new commits. Configure here.