150
return err
151
}
153
defer resetState()
154
}
155
156
// ** Step 5: Wait for Remote Cluster to completely drain its Replication Tasks
158
>
StartToCloseTimeout: time.Second * time.Duration(params.HandoverTimeoutSeconds),
159
>
HeartbeatTimeout: time.Second * 10,
160
>
RetryPolicy: &temporal.RetryPolicy{
161
>
MaximumAttempts: 1,
162
>
},
163
>
}
164
>
ctx3 := workflow.WithActivityOptions(ctx, ao3)
165
>
waitHandover := waitHandoverRequest{
166
>
ShardCount: metadataResp.ShardCount,
167
>
Namespace: params.Namespace,
168
>
RemoteCluster: params.RemoteCluster,
169
>
}
170
>
err = workflow.ExecuteActivity(ctx3, a.WaitHandover, waitHandover).Get(ctx3, nil)
171
>
if err != nil {
172
return err
173
}
174
175
// ** Step 6: Remote Cluster is caught up. Update Namespace to be Active on the Remote Cluster.
177
>
Namespace: params.Namespace,
178
>
ActiveCluster: params.RemoteCluster,
179
>
}
180
>
err = workflow.ExecuteActivity(ctx, a.UpdateActiveCluster, updateRequest).Get(ctx, nil)
181
>
if err != nil {
182
return err
183
}
184
186
}
187