@temporalio/core-bridge 0.14.0 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +162 -38
- package/Cargo.toml +3 -3
- package/index.d.ts +14 -1
- package/index.node +0 -0
- package/package.json +8 -5
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/{x86_64-pc-windows-gnu → aarch64-unknown-linux-gnu}/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/scripts/build.js +77 -34
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/Cargo.toml +6 -5
- package/sdk-core/fsm/Cargo.toml +1 -1
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +2 -2
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +8 -9
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +13 -7
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +2 -2
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +1 -1
- package/sdk-core/protos/local/workflow_activation.proto +6 -3
- package/sdk-core/sdk-core-protos/Cargo.toml +4 -4
- package/sdk-core/sdk-core-protos/src/lib.rs +38 -50
- package/sdk-core/src/core_tests/activity_tasks.rs +5 -5
- package/sdk-core/src/core_tests/child_workflows.rs +55 -29
- package/sdk-core/src/core_tests/determinism.rs +19 -9
- package/sdk-core/src/core_tests/mod.rs +3 -3
- package/sdk-core/src/core_tests/retry.rs +14 -8
- package/sdk-core/src/core_tests/workers.rs +1 -1
- package/sdk-core/src/core_tests/workflow_tasks.rs +347 -4
- package/sdk-core/src/errors.rs +27 -44
- package/sdk-core/src/lib.rs +13 -3
- package/sdk-core/src/machines/activity_state_machine.rs +44 -5
- package/sdk-core/src/machines/child_workflow_state_machine.rs +31 -11
- package/sdk-core/src/machines/complete_workflow_state_machine.rs +1 -1
- package/sdk-core/src/machines/continue_as_new_workflow_state_machine.rs +1 -1
- package/sdk-core/src/machines/mod.rs +18 -23
- package/sdk-core/src/machines/patch_state_machine.rs +8 -8
- package/sdk-core/src/machines/signal_external_state_machine.rs +22 -1
- package/sdk-core/src/machines/timer_state_machine.rs +21 -3
- package/sdk-core/src/machines/transition_coverage.rs +3 -3
- package/sdk-core/src/machines/workflow_machines.rs +11 -11
- package/sdk-core/src/pending_activations.rs +27 -22
- package/sdk-core/src/pollers/gateway.rs +15 -7
- package/sdk-core/src/pollers/poll_buffer.rs +6 -5
- package/sdk-core/src/pollers/retry.rs +153 -120
- package/sdk-core/src/prototype_rust_sdk/workflow_context.rs +61 -46
- package/sdk-core/src/prototype_rust_sdk/workflow_future.rs +13 -12
- package/sdk-core/src/prototype_rust_sdk.rs +17 -23
- package/sdk-core/src/telemetry/metrics.rs +2 -4
- package/sdk-core/src/telemetry/mod.rs +6 -7
- package/sdk-core/src/test_help/canned_histories.rs +17 -93
- package/sdk-core/src/test_help/history_builder.rs +61 -2
- package/sdk-core/src/test_help/history_info.rs +21 -2
- package/sdk-core/src/test_help/mod.rs +26 -34
- package/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +246 -138
- package/sdk-core/src/worker/activities.rs +46 -45
- package/sdk-core/src/worker/config.rs +11 -0
- package/sdk-core/src/worker/dispatcher.rs +5 -5
- package/sdk-core/src/worker/mod.rs +86 -56
- package/sdk-core/src/workflow/driven_workflow.rs +3 -3
- package/sdk-core/src/workflow/history_update.rs +1 -1
- package/sdk-core/src/workflow/mod.rs +2 -1
- package/sdk-core/src/workflow/workflow_tasks/cache_manager.rs +13 -17
- package/sdk-core/src/workflow/workflow_tasks/concurrency_manager.rs +10 -18
- package/sdk-core/src/workflow/workflow_tasks/mod.rs +72 -57
- package/sdk-core/test_utils/Cargo.toml +1 -1
- package/sdk-core/test_utils/src/lib.rs +2 -2
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +61 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +2 -2
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +49 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +2 -2
- package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
- package/src/conversions.rs +17 -0
- package/src/errors.rs +0 -7
- package/src/lib.rs +0 -20
|
@@ -165,7 +165,7 @@ impl Default for RetryConfig {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
impl RetryConfig {
|
|
168
|
-
pub(crate) fn poll_retry_policy() -> Self {
|
|
168
|
+
pub(crate) const fn poll_retry_policy() -> Self {
|
|
169
169
|
Self {
|
|
170
170
|
initial_interval: Duration::from_millis(200),
|
|
171
171
|
randomization_factor: 0.2,
|
|
@@ -179,7 +179,7 @@ impl RetryConfig {
|
|
|
179
179
|
|
|
180
180
|
impl From<RetryConfig> for ExponentialBackoff {
|
|
181
181
|
fn from(c: RetryConfig) -> Self {
|
|
182
|
-
|
|
182
|
+
Self {
|
|
183
183
|
current_interval: c.initial_interval,
|
|
184
184
|
initial_interval: c.initial_interval,
|
|
185
185
|
randomization_factor: c.randomization_factor,
|
|
@@ -269,7 +269,7 @@ impl Interceptor for ServiceCallInterceptor {
|
|
|
269
269
|
.parse()
|
|
270
270
|
.unwrap_or_else(|_| MetadataValue::from_static("")),
|
|
271
271
|
);
|
|
272
|
-
for (k, v) in self.opts.static_headers
|
|
272
|
+
for (k, v) in &self.opts.static_headers {
|
|
273
273
|
if let (Ok(k), Ok(v)) = (MetadataKey::from_str(k), MetadataValue::from_str(v)) {
|
|
274
274
|
metadata.insert(k, v);
|
|
275
275
|
}
|
|
@@ -355,8 +355,11 @@ pub trait ServerGatewayApis {
|
|
|
355
355
|
|
|
356
356
|
/// Fetch new workflow tasks from the provided queue. Should block indefinitely if there is no
|
|
357
357
|
/// work.
|
|
358
|
-
async fn poll_workflow_task(
|
|
359
|
-
|
|
358
|
+
async fn poll_workflow_task(
|
|
359
|
+
&self,
|
|
360
|
+
task_queue: String,
|
|
361
|
+
is_sticky: bool,
|
|
362
|
+
) -> Result<PollWorkflowTaskQueueResponse>;
|
|
360
363
|
|
|
361
364
|
/// Fetch new activity tasks from the provided queue. Should block indefinitely if there is no
|
|
362
365
|
/// work.
|
|
@@ -516,12 +519,17 @@ impl ServerGatewayApis for ServerGateway {
|
|
|
516
519
|
async fn poll_workflow_task(
|
|
517
520
|
&self,
|
|
518
521
|
task_queue: String,
|
|
522
|
+
is_sticky: bool,
|
|
519
523
|
) -> Result<PollWorkflowTaskQueueResponse> {
|
|
520
524
|
let mut request = PollWorkflowTaskQueueRequest {
|
|
521
525
|
namespace: self.opts.namespace.clone(),
|
|
522
526
|
task_queue: Some(TaskQueue {
|
|
523
527
|
name: task_queue,
|
|
524
|
-
kind:
|
|
528
|
+
kind: if is_sticky {
|
|
529
|
+
TaskQueueKind::Sticky
|
|
530
|
+
} else {
|
|
531
|
+
TaskQueueKind::Normal
|
|
532
|
+
} as i32,
|
|
525
533
|
}),
|
|
526
534
|
identity: self.opts.identity.clone(),
|
|
527
535
|
binary_checksum: self.opts.worker_binary_id.clone(),
|
|
@@ -894,7 +902,7 @@ mockall::mock! {
|
|
|
894
902
|
) -> impl Future<Output = Result<StartWorkflowExecutionResponse>> + Send + 'b
|
|
895
903
|
where 'a: 'b, Self: 'b;
|
|
896
904
|
|
|
897
|
-
fn poll_workflow_task<'a, 'b>(&'a self, task_queue: String)
|
|
905
|
+
fn poll_workflow_task<'a, 'b>(&'a self, task_queue: String, is_sticky: bool)
|
|
898
906
|
-> impl Future<Output = Result<PollWorkflowTaskQueueResponse>> + Send + 'b
|
|
899
907
|
where 'a: 'b, Self: 'b;
|
|
900
908
|
|
|
@@ -152,7 +152,7 @@ where
|
|
|
152
152
|
|
|
153
153
|
async fn shutdown_box(self: Box<Self>) {
|
|
154
154
|
let this = *self;
|
|
155
|
-
this.shutdown().await
|
|
155
|
+
this.shutdown().await;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -192,7 +192,7 @@ impl Poller<PollWorkflowTaskQueueResponse> for WorkflowTaskPoller {
|
|
|
192
192
|
|
|
193
193
|
async fn shutdown_box(self: Box<Self>) {
|
|
194
194
|
let this = *self;
|
|
195
|
-
this.shutdown().await
|
|
195
|
+
this.shutdown().await;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -200,6 +200,7 @@ pub type PollWorkflowTaskBuffer = LongPollBuffer<PollWorkflowTaskQueueResponse>;
|
|
|
200
200
|
pub fn new_workflow_task_buffer(
|
|
201
201
|
sg: Arc<impl ServerGatewayApis + Send + Sync + 'static + ?Sized>,
|
|
202
202
|
task_queue: String,
|
|
203
|
+
is_sticky: bool,
|
|
203
204
|
concurrent_pollers: usize,
|
|
204
205
|
buffer_size: usize,
|
|
205
206
|
) -> PollWorkflowTaskBuffer {
|
|
@@ -207,7 +208,7 @@ pub fn new_workflow_task_buffer(
|
|
|
207
208
|
move || {
|
|
208
209
|
let sg = sg.clone();
|
|
209
210
|
let task_queue = task_queue.clone();
|
|
210
|
-
async move { sg.poll_workflow_task(task_queue).await }
|
|
211
|
+
async move { sg.poll_workflow_task(task_queue, is_sticky).await }
|
|
211
212
|
},
|
|
212
213
|
concurrent_pollers,
|
|
213
214
|
buffer_size,
|
|
@@ -246,7 +247,7 @@ mod tests {
|
|
|
246
247
|
mock_gateway
|
|
247
248
|
.expect_poll_workflow_task()
|
|
248
249
|
.times(2)
|
|
249
|
-
.returning(move |_| {
|
|
250
|
+
.returning(move |_, _| {
|
|
250
251
|
async {
|
|
251
252
|
tokio::time::sleep(Duration::from_millis(100)).await;
|
|
252
253
|
Ok(Default::default())
|
|
@@ -255,7 +256,7 @@ mod tests {
|
|
|
255
256
|
});
|
|
256
257
|
let mock_gateway = Arc::new(mock_gateway);
|
|
257
258
|
|
|
258
|
-
let pb = new_workflow_task_buffer(mock_gateway, "someq".to_string(), 1, 1);
|
|
259
|
+
let pb = new_workflow_task_buffer(mock_gateway, "someq".to_string(), false, 1, 1);
|
|
259
260
|
|
|
260
261
|
// Poll a bunch of times, "interrupting" it each time, we should only actually have polled
|
|
261
262
|
// once since the poll takes a while
|
|
@@ -27,7 +27,7 @@ pub struct RetryGateway<SG> {
|
|
|
27
27
|
|
|
28
28
|
impl<SG> RetryGateway<SG> {
|
|
29
29
|
/// Use the provided retry config with the provided gateway
|
|
30
|
-
pub fn new(gateway: SG, retry_config: RetryConfig) -> Self {
|
|
30
|
+
pub const fn new(gateway: SG, retry_config: RetryConfig) -> Self {
|
|
31
31
|
Self {
|
|
32
32
|
gateway,
|
|
33
33
|
retry_config,
|
|
@@ -36,23 +36,12 @@ impl<SG> RetryGateway<SG> {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
impl<SG: ServerGatewayApis + Send + Sync + 'static> RetryGateway<SG> {
|
|
39
|
-
async fn call_with_retry<R, F, Fut>(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async fn long_poll_call_with_retry<R, F, Fut>(&self, factory: F) -> Result<R>
|
|
48
|
-
where
|
|
49
|
-
F: Fn() -> Fut + Unpin,
|
|
50
|
-
Fut: Future<Output = Result<R>>,
|
|
51
|
-
{
|
|
52
|
-
self.call_type_with_retry(factory, CallType::LongPoll).await
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async fn call_type_with_retry<R, F, Fut>(&self, factory: F, ct: CallType) -> Result<R>
|
|
39
|
+
async fn call_with_retry<R, F, Fut>(
|
|
40
|
+
&self,
|
|
41
|
+
factory: F,
|
|
42
|
+
ct: CallType,
|
|
43
|
+
call_name: &'static str,
|
|
44
|
+
) -> Result<R>
|
|
56
45
|
where
|
|
57
46
|
F: Fn() -> Fut + Unpin,
|
|
58
47
|
Fut: Future<Output = Result<R>>,
|
|
@@ -61,10 +50,12 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> RetryGateway<SG> {
|
|
|
61
50
|
CallType::Normal => self.retry_config.clone(),
|
|
62
51
|
CallType::LongPoll => RetryConfig::poll_retry_policy(),
|
|
63
52
|
};
|
|
64
|
-
Ok(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
Ok(
|
|
54
|
+
FutureRetry::new(factory, TonicErrorHandler::new(rtc, ct, call_name))
|
|
55
|
+
.await
|
|
56
|
+
.map_err(|(e, _attempt)| e)?
|
|
57
|
+
.0,
|
|
58
|
+
)
|
|
68
59
|
}
|
|
69
60
|
}
|
|
70
61
|
|
|
@@ -73,17 +64,19 @@ struct TonicErrorHandler {
|
|
|
73
64
|
backoff: ExponentialBackoff,
|
|
74
65
|
max_retries: usize,
|
|
75
66
|
call_type: CallType,
|
|
67
|
+
call_name: &'static str,
|
|
76
68
|
}
|
|
77
69
|
impl TonicErrorHandler {
|
|
78
|
-
fn new(cfg: RetryConfig, call_type: CallType) -> Self {
|
|
70
|
+
fn new(cfg: RetryConfig, call_type: CallType, call_name: &'static str) -> Self {
|
|
79
71
|
Self {
|
|
80
72
|
max_retries: cfg.max_retries,
|
|
81
73
|
backoff: cfg.into(),
|
|
82
74
|
call_type,
|
|
75
|
+
call_name,
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
78
|
|
|
86
|
-
fn should_log_retry_warning(&self, cur_attempt: usize) -> bool {
|
|
79
|
+
const fn should_log_retry_warning(&self, cur_attempt: usize) -> bool {
|
|
87
80
|
// Warn on more than 5 retries for unlimited retrying
|
|
88
81
|
if self.max_retries == 0 && cur_attempt > 5 {
|
|
89
82
|
return true;
|
|
@@ -111,9 +104,9 @@ impl ErrorHandler<tonic::Status> for TonicErrorHandler {
|
|
|
111
104
|
}
|
|
112
105
|
|
|
113
106
|
if current_attempt == 1 {
|
|
114
|
-
debug!(error=?e, "gRPC call failed on first attempt")
|
|
107
|
+
debug!(error=?e, "gRPC call {} failed on first attempt", self.call_name);
|
|
115
108
|
} else if self.should_log_retry_warning(current_attempt) {
|
|
116
|
-
warn!(error=?e, "gRPC call retried {} times", current_attempt)
|
|
109
|
+
warn!(error=?e, "gRPC call {} retried {} times", self.call_name, current_attempt);
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
// Long polls are OK with being cancelled or running into the timeout because there's
|
|
@@ -140,6 +133,13 @@ impl ErrorHandler<tonic::Status> for TonicErrorHandler {
|
|
|
140
133
|
}
|
|
141
134
|
}
|
|
142
135
|
|
|
136
|
+
macro_rules! retry_call {
|
|
137
|
+
($myself:ident, $ctype:expr, $call_name:ident, $($args:expr),*) => {{
|
|
138
|
+
let fact = move || { $myself.gateway.$call_name($($args,)*)};
|
|
139
|
+
$myself.call_with_retry(fact, $ctype, stringify!($call_name)).await
|
|
140
|
+
}};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
143
|
#[async_trait::async_trait]
|
|
144
144
|
impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryGateway<SG> {
|
|
145
145
|
async fn start_workflow(
|
|
@@ -150,33 +150,42 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
150
150
|
workflow_type: String,
|
|
151
151
|
task_timeout: Option<Duration>,
|
|
152
152
|
) -> Result<StartWorkflowExecutionResponse> {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
self.call_with_retry(factory).await
|
|
153
|
+
retry_call!(
|
|
154
|
+
self,
|
|
155
|
+
CallType::Normal,
|
|
156
|
+
start_workflow,
|
|
157
|
+
input.clone(),
|
|
158
|
+
task_queue.clone(),
|
|
159
|
+
workflow_id.clone(),
|
|
160
|
+
workflow_type.clone(),
|
|
161
|
+
task_timeout
|
|
162
|
+
)
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
async fn poll_workflow_task(
|
|
167
166
|
&self,
|
|
168
167
|
task_queue: String,
|
|
168
|
+
is_sticky: bool,
|
|
169
169
|
) -> Result<PollWorkflowTaskQueueResponse> {
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
retry_call!(
|
|
171
|
+
self,
|
|
172
|
+
CallType::LongPoll,
|
|
173
|
+
poll_workflow_task,
|
|
174
|
+
task_queue.clone(),
|
|
175
|
+
is_sticky
|
|
176
|
+
)
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
async fn poll_activity_task(
|
|
175
180
|
&self,
|
|
176
181
|
task_queue: String,
|
|
177
182
|
) -> Result<PollActivityTaskQueueResponse> {
|
|
178
|
-
|
|
179
|
-
|
|
183
|
+
retry_call!(
|
|
184
|
+
self,
|
|
185
|
+
CallType::LongPoll,
|
|
186
|
+
poll_activity_task,
|
|
187
|
+
task_queue.clone()
|
|
188
|
+
)
|
|
180
189
|
}
|
|
181
190
|
|
|
182
191
|
async fn reset_sticky_task_queue(
|
|
@@ -184,19 +193,25 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
184
193
|
workflow_id: String,
|
|
185
194
|
run_id: String,
|
|
186
195
|
) -> Result<ResetStickyTaskQueueResponse> {
|
|
187
|
-
|
|
188
|
-
self
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
196
|
+
retry_call!(
|
|
197
|
+
self,
|
|
198
|
+
CallType::Normal,
|
|
199
|
+
reset_sticky_task_queue,
|
|
200
|
+
workflow_id.clone(),
|
|
201
|
+
run_id.clone()
|
|
202
|
+
)
|
|
192
203
|
}
|
|
193
204
|
|
|
194
205
|
async fn complete_workflow_task(
|
|
195
206
|
&self,
|
|
196
207
|
request: WorkflowTaskCompletion,
|
|
197
208
|
) -> Result<RespondWorkflowTaskCompletedResponse> {
|
|
198
|
-
|
|
199
|
-
|
|
209
|
+
retry_call!(
|
|
210
|
+
self,
|
|
211
|
+
CallType::Normal,
|
|
212
|
+
complete_workflow_task,
|
|
213
|
+
request.clone()
|
|
214
|
+
)
|
|
200
215
|
}
|
|
201
216
|
|
|
202
217
|
async fn complete_activity_task(
|
|
@@ -204,11 +219,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
204
219
|
task_token: TaskToken,
|
|
205
220
|
result: Option<Payloads>,
|
|
206
221
|
) -> Result<RespondActivityTaskCompletedResponse> {
|
|
207
|
-
|
|
208
|
-
self
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
222
|
+
retry_call!(
|
|
223
|
+
self,
|
|
224
|
+
CallType::Normal,
|
|
225
|
+
complete_activity_task,
|
|
226
|
+
task_token.clone(),
|
|
227
|
+
result.clone()
|
|
228
|
+
)
|
|
212
229
|
}
|
|
213
230
|
|
|
214
231
|
async fn record_activity_heartbeat(
|
|
@@ -216,11 +233,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
216
233
|
task_token: TaskToken,
|
|
217
234
|
details: Option<Payloads>,
|
|
218
235
|
) -> Result<RecordActivityTaskHeartbeatResponse> {
|
|
219
|
-
|
|
220
|
-
self
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
236
|
+
retry_call!(
|
|
237
|
+
self,
|
|
238
|
+
CallType::Normal,
|
|
239
|
+
record_activity_heartbeat,
|
|
240
|
+
task_token.clone(),
|
|
241
|
+
details.clone()
|
|
242
|
+
)
|
|
224
243
|
}
|
|
225
244
|
|
|
226
245
|
async fn cancel_activity_task(
|
|
@@ -228,11 +247,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
228
247
|
task_token: TaskToken,
|
|
229
248
|
details: Option<Payloads>,
|
|
230
249
|
) -> Result<RespondActivityTaskCanceledResponse> {
|
|
231
|
-
|
|
232
|
-
self
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
250
|
+
retry_call!(
|
|
251
|
+
self,
|
|
252
|
+
CallType::Normal,
|
|
253
|
+
cancel_activity_task,
|
|
254
|
+
task_token.clone(),
|
|
255
|
+
details.clone()
|
|
256
|
+
)
|
|
236
257
|
}
|
|
237
258
|
|
|
238
259
|
async fn fail_activity_task(
|
|
@@ -240,11 +261,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
240
261
|
task_token: TaskToken,
|
|
241
262
|
failure: Option<Failure>,
|
|
242
263
|
) -> Result<RespondActivityTaskFailedResponse> {
|
|
243
|
-
|
|
244
|
-
self
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
264
|
+
retry_call!(
|
|
265
|
+
self,
|
|
266
|
+
CallType::Normal,
|
|
267
|
+
fail_activity_task,
|
|
268
|
+
task_token.clone(),
|
|
269
|
+
failure.clone()
|
|
270
|
+
)
|
|
248
271
|
}
|
|
249
272
|
|
|
250
273
|
async fn fail_workflow_task(
|
|
@@ -253,11 +276,14 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
253
276
|
cause: WorkflowTaskFailedCause,
|
|
254
277
|
failure: Option<Failure>,
|
|
255
278
|
) -> Result<RespondWorkflowTaskFailedResponse> {
|
|
256
|
-
|
|
257
|
-
self
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
279
|
+
retry_call!(
|
|
280
|
+
self,
|
|
281
|
+
CallType::Normal,
|
|
282
|
+
fail_workflow_task,
|
|
283
|
+
task_token.clone(),
|
|
284
|
+
cause,
|
|
285
|
+
failure.clone()
|
|
286
|
+
)
|
|
261
287
|
}
|
|
262
288
|
|
|
263
289
|
async fn signal_workflow_execution(
|
|
@@ -267,15 +293,15 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
267
293
|
signal_name: String,
|
|
268
294
|
payloads: Option<Payloads>,
|
|
269
295
|
) -> Result<SignalWorkflowExecutionResponse> {
|
|
270
|
-
|
|
271
|
-
self
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
)
|
|
277
|
-
|
|
278
|
-
|
|
296
|
+
retry_call!(
|
|
297
|
+
self,
|
|
298
|
+
CallType::Normal,
|
|
299
|
+
signal_workflow_execution,
|
|
300
|
+
workflow_id.clone(),
|
|
301
|
+
run_id.clone(),
|
|
302
|
+
signal_name.clone(),
|
|
303
|
+
payloads.clone()
|
|
304
|
+
)
|
|
279
305
|
}
|
|
280
306
|
|
|
281
307
|
async fn query_workflow_execution(
|
|
@@ -284,14 +310,14 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
284
310
|
run_id: String,
|
|
285
311
|
query: WorkflowQuery,
|
|
286
312
|
) -> Result<QueryWorkflowResponse> {
|
|
287
|
-
|
|
288
|
-
self
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
)
|
|
293
|
-
|
|
294
|
-
|
|
313
|
+
retry_call!(
|
|
314
|
+
self,
|
|
315
|
+
CallType::Normal,
|
|
316
|
+
query_workflow_execution,
|
|
317
|
+
workflow_id.clone(),
|
|
318
|
+
run_id.clone(),
|
|
319
|
+
query.clone()
|
|
320
|
+
)
|
|
295
321
|
}
|
|
296
322
|
|
|
297
323
|
async fn describe_workflow_execution(
|
|
@@ -299,11 +325,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
299
325
|
workflow_id: String,
|
|
300
326
|
run_id: Option<String>,
|
|
301
327
|
) -> Result<DescribeWorkflowExecutionResponse> {
|
|
302
|
-
|
|
303
|
-
self
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
328
|
+
retry_call!(
|
|
329
|
+
self,
|
|
330
|
+
CallType::Normal,
|
|
331
|
+
describe_workflow_execution,
|
|
332
|
+
workflow_id.clone(),
|
|
333
|
+
run_id.clone()
|
|
334
|
+
)
|
|
307
335
|
}
|
|
308
336
|
|
|
309
337
|
async fn get_workflow_execution_history(
|
|
@@ -312,14 +340,14 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
312
340
|
run_id: Option<String>,
|
|
313
341
|
page_token: Vec<u8>,
|
|
314
342
|
) -> Result<GetWorkflowExecutionHistoryResponse> {
|
|
315
|
-
|
|
316
|
-
self
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
)
|
|
321
|
-
|
|
322
|
-
|
|
343
|
+
retry_call!(
|
|
344
|
+
self,
|
|
345
|
+
CallType::Normal,
|
|
346
|
+
get_workflow_execution_history,
|
|
347
|
+
workflow_id.clone(),
|
|
348
|
+
run_id.clone(),
|
|
349
|
+
page_token.clone()
|
|
350
|
+
)
|
|
323
351
|
}
|
|
324
352
|
|
|
325
353
|
async fn respond_legacy_query(
|
|
@@ -327,11 +355,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
327
355
|
task_token: TaskToken,
|
|
328
356
|
query_result: QueryResult,
|
|
329
357
|
) -> Result<RespondQueryTaskCompletedResponse> {
|
|
330
|
-
|
|
331
|
-
self
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
358
|
+
retry_call!(
|
|
359
|
+
self,
|
|
360
|
+
CallType::Normal,
|
|
361
|
+
respond_legacy_query,
|
|
362
|
+
task_token.clone(),
|
|
363
|
+
query_result.clone()
|
|
364
|
+
)
|
|
335
365
|
}
|
|
336
366
|
|
|
337
367
|
async fn cancel_workflow_execution(
|
|
@@ -339,11 +369,13 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
339
369
|
workflow_id: String,
|
|
340
370
|
run_id: Option<String>,
|
|
341
371
|
) -> Result<RequestCancelWorkflowExecutionResponse> {
|
|
342
|
-
|
|
343
|
-
self
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
372
|
+
retry_call!(
|
|
373
|
+
self,
|
|
374
|
+
CallType::Normal,
|
|
375
|
+
cancel_workflow_execution,
|
|
376
|
+
workflow_id.clone(),
|
|
377
|
+
run_id.clone()
|
|
378
|
+
)
|
|
347
379
|
}
|
|
348
380
|
|
|
349
381
|
async fn terminate_workflow_execution(
|
|
@@ -351,15 +383,16 @@ impl<SG: ServerGatewayApis + Send + Sync + 'static> ServerGatewayApis for RetryG
|
|
|
351
383
|
workflow_id: String,
|
|
352
384
|
run_id: Option<String>,
|
|
353
385
|
) -> Result<TerminateWorkflowExecutionResponse> {
|
|
354
|
-
|
|
355
|
-
self
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
386
|
+
retry_call!(
|
|
387
|
+
self,
|
|
388
|
+
CallType::Normal,
|
|
389
|
+
terminate_workflow_execution,
|
|
390
|
+
workflow_id.clone(),
|
|
391
|
+
run_id.clone()
|
|
392
|
+
)
|
|
359
393
|
}
|
|
360
394
|
|
|
361
395
|
async fn list_namespaces(&self) -> Result<ListNamespacesResponse> {
|
|
362
|
-
|
|
363
|
-
self.call_with_retry(factory).await
|
|
396
|
+
retry_call!(self, CallType::Normal, list_namespaces,)
|
|
364
397
|
}
|
|
365
398
|
}
|