@@ -159,13 +159,14 @@ func (r *TaskGeneratorImpl) GenerateWorkflowCloseTasks(
159
159
160
160
currentVersion := r .mutableState .GetCurrentVersion ()
161
161
162
+ closeExecutionTask := & tasks.CloseExecutionTask {
163
+ // TaskID, Visiblitytimestamp is set by shard
164
+ WorkflowKey : r .mutableState .GetWorkflowKey (),
165
+ Version : currentVersion ,
166
+ DeleteAfterClose : deleteAfterClose ,
167
+ }
162
168
closeTasks := []tasks.Task {
163
- & tasks.CloseExecutionTask {
164
- // TaskID, Visiblitytimestamp is set by shard
165
- WorkflowKey : r .mutableState .GetWorkflowKey (),
166
- Version : currentVersion ,
167
- DeleteAfterClose : deleteAfterClose ,
168
- },
169
+ closeExecutionTask ,
169
170
}
170
171
171
172
// To avoid race condition between visibility close and delete tasks, visibility close task is not created here.
@@ -205,6 +206,9 @@ func (r *TaskGeneratorImpl) GenerateWorkflowCloseTasks(
205
206
// archiveTime is the time when the archival queue recognizes the ArchiveExecutionTask as ready-to-process
206
207
archiveTime := closeEvent .GetEventTime ().Add (delay )
207
208
209
+ // We can skip visibility archival in the close execution task if we are using the durable archival flow.
210
+ // The visibility archival will be handled by the archival queue.
211
+ closeExecutionTask .CanSkipVisibilityArchival = true
208
212
task := & tasks.ArchiveExecutionTask {
209
213
// TaskID is set by the shard
210
214
WorkflowKey : r .mutableState .GetWorkflowKey (),
0 commit comments