107
task *replicationspb.ReplicationTask,
108
forceApply bool,
110
>
111
>
attr := task.GetSyncActivityTaskAttributes()
112
>
doContinue, err := e.filterTask(namespace.ID(attr.GetNamespaceId()), attr.WorkflowId, forceApply)
113
>
if err != nil || !doContinue {
114
return err
115
}
116
118
>
defer func() {
119
>
metrics.ServiceLatency.With(e.metricsHandler).Record(
120
>
time.Since(startTime),
121
>
metrics.OperationTag(metrics.SyncActivityTaskScope),
122
>
metrics.NamespaceTag(attr.GetNamespaceId()),
123
>
)
124
>
}()
125
127
>
NamespaceId: attr.NamespaceId,
128
>
WorkflowId: attr.WorkflowId,
129
>
RunId: attr.RunId,
130
>
Version: attr.Version,
131
>
ScheduledEventId: attr.ScheduledEventId,
132
>
ScheduledTime: attr.ScheduledTime,
133
>
StartedEventId: attr.StartedEventId,
134
>
StartVersion: attr.StartVersion,
135
>
StartedTime: attr.StartedTime,
136
>
LastHeartbeatTime: attr.LastHeartbeatTime,
137
>
Details: attr.Details,
138
>
Attempt: attr.Attempt,
139
>
LastFailure: attr.LastFailure,
140
>
LastWorkerIdentity: attr.LastWorkerIdentity,
141
>
LastStartedBuildId: attr.LastStartedBuildId,
142
>
LastStartedRedirectCounter: attr.LastStartedRedirectCounter,
143
>
VersionHistory: attr.GetVersionHistory(),
144
>
}
145
>
namespaceName, _ := e.namespaceRegistry.GetNamespaceName(namespace.ID(attr.NamespaceId))
146
>
ctx, cancel := e.newTaskContext(ctx, namespaceName)
147
>
defer cancel()
148
>
149
>
// This might be extra cost if the workflow belongs to local shard.
150
>
// Add a wrapper of the history client to call history engine directly if it becomes an issue.
151
>
_, err = e.shardContext.GetHistoryClient().SyncActivity(ctx, request)
152
>
switch retryErr := err.(type) {
153
case nil:
154
return nil