@temporalio/core-bridge 1.1.0 → 1.3.1

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.
Files changed (114) hide show
  1. package/Cargo.lock +786 -54
  2. package/Cargo.toml +2 -2
  3. package/common.js +7 -3
  4. package/index.d.ts +110 -3
  5. package/index.js +2 -6
  6. package/package.json +3 -3
  7. package/releases/aarch64-apple-darwin/index.node +0 -0
  8. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  9. package/releases/x86_64-apple-darwin/index.node +0 -0
  10. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  11. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  12. package/scripts/build.js +4 -3
  13. package/sdk-core/.buildkite/docker/Dockerfile +2 -1
  14. package/sdk-core/ARCHITECTURE.md +2 -2
  15. package/sdk-core/README.md +12 -0
  16. package/sdk-core/bridge-ffi/Cargo.toml +2 -2
  17. package/sdk-core/client/Cargo.toml +6 -4
  18. package/sdk-core/client/src/lib.rs +338 -215
  19. package/sdk-core/client/src/raw.rs +352 -106
  20. package/sdk-core/client/src/retry.rs +159 -133
  21. package/sdk-core/client/src/workflow_handle/mod.rs +1 -1
  22. package/sdk-core/core/Cargo.toml +18 -9
  23. package/sdk-core/core/src/core_tests/activity_tasks.rs +63 -23
  24. package/sdk-core/core/src/core_tests/child_workflows.rs +125 -3
  25. package/sdk-core/core/src/core_tests/local_activities.rs +6 -6
  26. package/sdk-core/core/src/core_tests/workers.rs +3 -2
  27. package/sdk-core/core/src/core_tests/workflow_tasks.rs +70 -2
  28. package/sdk-core/core/src/ephemeral_server/mod.rs +499 -0
  29. package/sdk-core/core/src/lib.rs +60 -26
  30. package/sdk-core/core/src/pollers/poll_buffer.rs +4 -4
  31. package/sdk-core/core/src/replay/mod.rs +3 -3
  32. package/sdk-core/core/src/retry_logic.rs +10 -9
  33. package/sdk-core/core/src/telemetry/mod.rs +10 -7
  34. package/sdk-core/core/src/test_help/mod.rs +18 -8
  35. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +10 -10
  36. package/sdk-core/core/src/worker/activities/local_activities.rs +13 -13
  37. package/sdk-core/core/src/worker/activities.rs +6 -12
  38. package/sdk-core/core/src/worker/client.rs +193 -64
  39. package/sdk-core/core/src/worker/mod.rs +14 -19
  40. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +3 -0
  41. package/sdk-core/core/src/worker/workflow/history_update.rs +5 -5
  42. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +133 -85
  43. package/sdk-core/core/src/worker/workflow/machines/mod.rs +3 -2
  44. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +160 -105
  45. package/sdk-core/core/src/worker/workflow/managed_run.rs +2 -1
  46. package/sdk-core/core/src/worker/workflow/mod.rs +59 -58
  47. package/sdk-core/core/src/worker/workflow/run_cache.rs +5 -3
  48. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +7 -5
  49. package/sdk-core/core-api/Cargo.toml +2 -2
  50. package/sdk-core/core-api/src/errors.rs +3 -11
  51. package/sdk-core/core-api/src/worker.rs +7 -0
  52. package/sdk-core/protos/api_upstream/.buildkite/Dockerfile +1 -1
  53. package/sdk-core/protos/api_upstream/.github/CODEOWNERS +1 -1
  54. package/sdk-core/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +2 -6
  55. package/sdk-core/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +29 -0
  56. package/sdk-core/protos/api_upstream/Makefile +2 -2
  57. package/sdk-core/protos/api_upstream/buf.yaml +1 -0
  58. package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +86 -0
  59. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +26 -0
  60. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +46 -0
  61. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +7 -0
  62. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +14 -0
  63. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +51 -0
  64. package/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +18 -0
  65. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +57 -1
  66. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +1 -3
  67. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +4 -2
  68. package/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +11 -0
  69. package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +23 -0
  70. package/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +46 -0
  71. package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +1 -0
  72. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +172 -0
  73. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +30 -0
  74. package/sdk-core/protos/grpc/health/v1/health.proto +63 -0
  75. package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +18 -15
  76. package/sdk-core/protos/testsrv_upstream/Makefile +80 -0
  77. package/sdk-core/protos/testsrv_upstream/api-linter.yaml +38 -0
  78. package/sdk-core/protos/testsrv_upstream/buf.yaml +13 -0
  79. package/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +141 -0
  80. package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +63 -0
  81. package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +90 -0
  82. package/sdk-core/sdk/Cargo.toml +2 -2
  83. package/sdk-core/sdk/src/lib.rs +2 -2
  84. package/sdk-core/sdk/src/workflow_context/options.rs +36 -8
  85. package/sdk-core/sdk/src/workflow_context.rs +30 -6
  86. package/sdk-core/sdk/src/workflow_future.rs +4 -4
  87. package/sdk-core/sdk-core-protos/Cargo.toml +5 -5
  88. package/sdk-core/sdk-core-protos/build.rs +9 -1
  89. package/sdk-core/sdk-core-protos/src/history_builder.rs +6 -1
  90. package/sdk-core/sdk-core-protos/src/lib.rs +93 -32
  91. package/sdk-core/test-utils/Cargo.toml +3 -3
  92. package/sdk-core/test-utils/src/canned_histories.rs +58 -0
  93. package/sdk-core/test-utils/src/lib.rs +14 -10
  94. package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +141 -0
  95. package/sdk-core/tests/integ_tests/heartbeat_tests.rs +55 -5
  96. package/sdk-core/tests/integ_tests/polling_tests.rs +1 -1
  97. package/sdk-core/tests/integ_tests/queries_tests.rs +4 -4
  98. package/sdk-core/tests/integ_tests/visibility_tests.rs +93 -0
  99. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -10
  100. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
  101. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +14 -14
  102. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +1 -1
  103. package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +12 -12
  104. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +12 -1
  105. package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +3 -3
  106. package/sdk-core/tests/integ_tests/workflow_tests.rs +19 -4
  107. package/sdk-core/tests/load_tests.rs +2 -1
  108. package/sdk-core/tests/main.rs +10 -0
  109. package/src/conversions.rs +138 -91
  110. package/src/helpers.rs +190 -0
  111. package/src/lib.rs +10 -912
  112. package/src/runtime.rs +436 -0
  113. package/src/testing.rs +67 -0
  114. package/src/worker.rs +465 -0
@@ -81,7 +81,7 @@ const NANOS_PER_SEC: u32 = 1_000_000_000;
81
81
  fn try_from_secs_f64(secs: f64) -> Option<Duration> {
82
82
  const MAX_NANOS_F64: f64 = ((u64::MAX as u128 + 1) * (NANOS_PER_SEC as u128)) as f64;
83
83
  let nanos = secs * (NANOS_PER_SEC as f64);
84
- if !nanos.is_finite() || nanos >= MAX_NANOS_F64 || nanos < 0.0 {
84
+ if !nanos.is_finite() || !(0.0..MAX_NANOS_F64).contains(&nanos) {
85
85
  None
86
86
  } else {
87
87
  Some(Duration::from_secs_f64(secs))
@@ -91,13 +91,14 @@ fn try_from_secs_f64(secs: f64) -> Option<Duration> {
91
91
  #[cfg(test)]
92
92
  mod tests {
93
93
  use super::*;
94
+ use crate::prost_dur;
94
95
 
95
96
  #[test]
96
97
  fn calcs_backoffs_properly() {
97
98
  let rp = RetryPolicy {
98
- initial_interval: Some(Duration::from_secs(1).into()),
99
+ initial_interval: Some(prost_dur!(from_secs(1))),
99
100
  backoff_coefficient: 2.0,
100
- maximum_interval: Some(Duration::from_secs(10).into()),
101
+ maximum_interval: Some(prost_dur!(from_secs(10))),
101
102
  maximum_attempts: 10,
102
103
  non_retryable_error_types: vec![],
103
104
  };
@@ -132,7 +133,7 @@ mod tests {
132
133
  #[test]
133
134
  fn max_attempts_zero_retry_forever() {
134
135
  let rp = RetryPolicy {
135
- initial_interval: Some(Duration::from_secs(1).into()),
136
+ initial_interval: Some(prost_dur!(from_secs(1))),
136
137
  backoff_coefficient: 1.2,
137
138
  maximum_interval: None,
138
139
  maximum_attempts: 0,
@@ -146,7 +147,7 @@ mod tests {
146
147
  #[test]
147
148
  fn no_overflows() {
148
149
  let rp = RetryPolicy {
149
- initial_interval: Some(Duration::from_secs(1).into()),
150
+ initial_interval: Some(prost_dur!(from_secs(1))),
150
151
  backoff_coefficient: 10.,
151
152
  maximum_interval: None,
152
153
  maximum_attempts: 0,
@@ -160,9 +161,9 @@ mod tests {
160
161
  #[test]
161
162
  fn no_retry_err_str_match() {
162
163
  let rp = RetryPolicy {
163
- initial_interval: Some(Duration::from_secs(1).into()),
164
+ initial_interval: Some(prost_dur!(from_secs(1))),
164
165
  backoff_coefficient: 2.0,
165
- maximum_interval: Some(Duration::from_secs(10).into()),
166
+ maximum_interval: Some(prost_dur!(from_secs(10))),
166
167
  maximum_attempts: 10,
167
168
  non_retryable_error_types: vec!["no retry".to_string()],
168
169
  };
@@ -181,9 +182,9 @@ mod tests {
181
182
  #[test]
182
183
  fn no_non_retryable_application_failure() {
183
184
  let rp = RetryPolicy {
184
- initial_interval: Some(Duration::from_secs(1).into()),
185
+ initial_interval: Some(prost_dur!(from_secs(1))),
185
186
  backoff_coefficient: 2.0,
186
- maximum_interval: Some(Duration::from_secs(10).into()),
187
+ maximum_interval: Some(prost_dur!(from_secs(10))),
187
188
  maximum_attempts: 10,
188
189
  non_retryable_error_types: vec![],
189
190
  };
@@ -25,7 +25,6 @@ use std::{
25
25
  time::Duration,
26
26
  };
27
27
  use temporal_sdk_core_api::CoreTelemetry;
28
- use tonic::metadata::MetadataMap;
29
28
  use tracing_subscriber::{filter::ParseError, layer::SubscriberExt, EnvFilter};
30
29
  use url::Url;
31
30
 
@@ -237,9 +236,11 @@ pub fn telemetry_init(opts: &TelemetryOptions) -> Result<&'static GlobalTelemDat
237
236
  opentelemetry_otlp::new_exporter()
238
237
  .tonic()
239
238
  .with_endpoint(url.to_string())
240
- .with_metadata(MetadataMap::from_headers(
241
- headers.try_into()?,
242
- )),
239
+ .with_metadata(
240
+ tonic_otel::metadata::MetadataMap::from_headers(
241
+ headers.try_into()?,
242
+ ),
243
+ ),
243
244
  )
244
245
  .build()?;
245
246
  global::set_meter_provider(metrics.provider());
@@ -261,9 +262,11 @@ pub fn telemetry_init(opts: &TelemetryOptions) -> Result<&'static GlobalTelemDat
261
262
  opentelemetry_otlp::new_exporter()
262
263
  .tonic()
263
264
  .with_endpoint(url.to_string())
264
- .with_metadata(MetadataMap::from_headers(
265
- headers.try_into()?,
266
- )),
265
+ .with_metadata(
266
+ tonic_otel::metadata::MetadataMap::from_headers(
267
+ headers.try_into()?,
268
+ ),
269
+ ),
267
270
  )
268
271
  .with_trace_config(tracer_cfg)
269
272
  .install_batch(opentelemetry::runtime::Tokio)?;
@@ -9,7 +9,7 @@ use crate::{
9
9
  client::{mocks::mock_workflow_client, MockWorkerClient, WorkerClient},
10
10
  new_wft_poller,
11
11
  },
12
- TaskToken, Worker, WorkerClientBag, WorkerConfig, WorkerConfigBuilder,
12
+ TaskToken, Worker, WorkerConfig, WorkerConfigBuilder,
13
13
  };
14
14
  use bimap::BiMap;
15
15
  use futures::{future::BoxFuture, stream, stream::BoxStream, FutureExt, Stream, StreamExt};
@@ -136,7 +136,7 @@ pub(crate) fn mock_worker(mocks: MocksHolder) -> Worker {
136
136
  Worker::new_with_pollers(
137
137
  mocks.inputs.config,
138
138
  sticky_q,
139
- Arc::new(mocks.client_bag),
139
+ mocks.client,
140
140
  mocks.inputs.wft_stream,
141
141
  mocks.inputs.act_poller,
142
142
  Default::default(),
@@ -166,7 +166,7 @@ pub struct FakeWfResponses {
166
166
 
167
167
  // TODO: Should be all-internal to this module
168
168
  pub struct MocksHolder {
169
- client_bag: WorkerClientBag,
169
+ client: Arc<dyn WorkerClient>,
170
170
  inputs: MockWorkerInputs,
171
171
  pub outstanding_task_map: Option<OutstandingWFTMap>,
172
172
  }
@@ -218,11 +218,11 @@ impl MockWorkerInputs {
218
218
 
219
219
  impl MocksHolder {
220
220
  pub(crate) fn from_mock_worker(
221
- client_bag: WorkerClientBag,
221
+ client: impl WorkerClient + 'static,
222
222
  mock_worker: MockWorkerInputs,
223
223
  ) -> Self {
224
224
  Self {
225
- client_bag,
225
+ client: Arc::new(client),
226
226
  inputs: mock_worker,
227
227
  outstanding_task_map: None,
228
228
  }
@@ -245,7 +245,7 @@ impl MocksHolder {
245
245
  config: test_worker_cfg().build().unwrap(),
246
246
  };
247
247
  Self {
248
- client_bag: client.into(),
248
+ client: Arc::new(client),
249
249
  inputs: mock_worker,
250
250
  outstanding_task_map: None,
251
251
  }
@@ -267,7 +267,7 @@ impl MocksHolder {
267
267
  config: test_worker_cfg().build().unwrap(),
268
268
  };
269
269
  Self {
270
- client_bag: client.into(),
270
+ client: Arc::new(client),
271
271
  inputs: mock_worker,
272
272
  outstanding_task_map: None,
273
273
  }
@@ -356,6 +356,7 @@ pub(crate) fn single_hist_mock_sg(
356
356
  build_mock_pollers(mh)
357
357
  }
358
358
 
359
+ #[allow(clippy::type_complexity)]
359
360
  pub(crate) struct MockPollCfg {
360
361
  pub hists: Vec<FakeWfResponses>,
361
362
  pub enforce_correct_number_of_polls: bool,
@@ -604,7 +605,7 @@ pub(crate) fn build_mock_pollers(mut cfg: MockPollCfg) -> MocksHolder {
604
605
  });
605
606
 
606
607
  MocksHolder {
607
- client_bag: cfg.mock_client.into(),
608
+ client: Arc::new(cfg.mock_client),
608
609
  inputs: mock_worker,
609
610
  outstanding_task_map: Some(outstanding_wf_task_tokens),
610
611
  }
@@ -863,3 +864,12 @@ macro_rules! advance_fut {
863
864
  }
864
865
  };
865
866
  }
867
+
868
+ #[macro_export]
869
+ macro_rules! prost_dur {
870
+ ($dur_call:ident $args:tt) => {
871
+ std::time::Duration::$dur_call$args
872
+ .try_into()
873
+ .expect("test duration fits")
874
+ };
875
+ }
@@ -1,5 +1,5 @@
1
1
  use crate::{
2
- worker::{activities::PendingActivityCancel, client::WorkerClientBag},
2
+ worker::{activities::PendingActivityCancel, client::WorkerClient},
3
3
  TaskToken,
4
4
  };
5
5
  use futures::StreamExt;
@@ -304,7 +304,7 @@ impl HeartbeatStreamState {
304
304
  impl ActivityHeartbeatManager {
305
305
  /// Creates a new instance of an activity heartbeat manager and returns a handle to the user,
306
306
  /// which allows to send new heartbeats and initiate the shutdown.
307
- pub fn new(client: Arc<WorkerClientBag>) -> Self {
307
+ pub fn new(client: Arc<dyn WorkerClient>) -> Self {
308
308
  let (heartbeat_stream_state, heartbeat_tx_source, shutdown_token) =
309
309
  HeartbeatStreamState::new();
310
310
  let (cancels_tx, cancels_rx) = unbounded_channel();
@@ -425,7 +425,7 @@ mod test {
425
425
  .expect_record_activity_heartbeat()
426
426
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
427
427
  .times(2);
428
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
428
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
429
429
  let fake_task_token = vec![1, 2, 3];
430
430
  // Send 2 heartbeat requests for 20ms apart.
431
431
  // The first heartbeat should be sent right away, and
@@ -446,9 +446,9 @@ mod test {
446
446
  .expect_record_activity_heartbeat()
447
447
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
448
448
  .times(3);
449
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
449
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
450
450
  let fake_task_token = vec![1, 2, 3];
451
- // Heartbeats always get sent if recorded less frequently than the throttle intreval
451
+ // Heartbeats always get sent if recorded less frequently than the throttle interval
452
452
  for i in 0_u8..3 {
453
453
  record_heartbeat(&hm, fake_task_token.clone(), i, Duration::from_millis(10));
454
454
  sleep(Duration::from_millis(20)).await;
@@ -466,7 +466,7 @@ mod test {
466
466
  .expect_record_activity_heartbeat()
467
467
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
468
468
  .times(1);
469
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
469
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
470
470
  let fake_task_token = vec![1, 2, 3];
471
471
  // Send a whole bunch of heartbeats very fast. We should still only send one total.
472
472
  for i in 0_u8..50 {
@@ -485,7 +485,7 @@ mod test {
485
485
  .expect_record_activity_heartbeat()
486
486
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
487
487
  .times(2);
488
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
488
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
489
489
  let fake_task_token = vec![1, 2, 3];
490
490
  record_heartbeat(&hm, fake_task_token.clone(), 0, Duration::from_millis(100));
491
491
  sleep(Duration::from_millis(500)).await;
@@ -502,7 +502,7 @@ mod test {
502
502
  .expect_record_activity_heartbeat()
503
503
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
504
504
  .times(2);
505
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
505
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
506
506
  let fake_task_token = vec![1, 2, 3];
507
507
  record_heartbeat(&hm, fake_task_token.clone(), 0, Duration::from_millis(100));
508
508
  // Let it propagate
@@ -522,7 +522,7 @@ mod test {
522
522
  .expect_record_activity_heartbeat()
523
523
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
524
524
  .times(1);
525
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
525
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
526
526
  let fake_task_token = vec![1, 2, 3];
527
527
  record_heartbeat(&hm, fake_task_token.clone(), 0, Duration::from_millis(100));
528
528
  hm.evict(fake_task_token.clone().into()).await;
@@ -537,7 +537,7 @@ mod test {
537
537
  .expect_record_activity_heartbeat()
538
538
  .returning(|_, _| Ok(RecordActivityTaskHeartbeatResponse::default()))
539
539
  .times(0);
540
- let hm = ActivityHeartbeatManager::new(Arc::new(mock_client.into()));
540
+ let hm = ActivityHeartbeatManager::new(Arc::new(mock_client));
541
541
  hm.shutdown().await;
542
542
  match hm.record(
543
543
  ActivityHeartbeat {
@@ -389,8 +389,8 @@ impl LocalActivityManager {
389
389
  current_attempt_scheduled_time: Some(new_la.schedule_time.into()),
390
390
  started_time: Some(SystemTime::now().into()),
391
391
  attempt,
392
- schedule_to_close_timeout: schedule_to_close.map(Into::into),
393
- start_to_close_timeout: start_to_close.map(Into::into),
392
+ schedule_to_close_timeout: schedule_to_close.and_then(|d| d.try_into().ok()),
393
+ start_to_close_timeout: start_to_close.and_then(|d| d.try_into().ok()),
394
394
  heartbeat_timeout: None,
395
395
  retry_policy: Some(sa.retry_policy),
396
396
  is_local: true,
@@ -440,7 +440,7 @@ impl LocalActivityManager {
440
440
  // We want this to be reported, as the workflow will mark this
441
441
  // failure down, then start a timer for backoff.
442
442
  return LACompleteAction::LangDoesTimerBackoff(
443
- backoff_dur.into(),
443
+ backoff_dur.try_into().expect("backoff fits into proto"),
444
444
  info,
445
445
  );
446
446
  }
@@ -638,7 +638,7 @@ impl Drop for TimeoutBag {
638
638
  #[cfg(test)]
639
639
  mod tests {
640
640
  use super::*;
641
- use crate::protosext::LACloseTimeouts;
641
+ use crate::{prost_dur, protosext::LACloseTimeouts};
642
642
  use temporal_sdk_core_protos::temporal::api::{
643
643
  common::v1::RetryPolicy,
644
644
  failure::v1::{failure::FailureInfo, ApplicationFailureInfo, Failure},
@@ -764,9 +764,9 @@ mod tests {
764
764
  activity_id: 1.to_string(),
765
765
  attempt: 5,
766
766
  retry_policy: RetryPolicy {
767
- initial_interval: Some(Duration::from_secs(1).into()),
767
+ initial_interval: Some(prost_dur!(from_secs(1))),
768
768
  backoff_coefficient: 10.0,
769
- maximum_interval: Some(Duration::from_secs(10).into()),
769
+ maximum_interval: Some(prost_dur!(from_secs(10))),
770
770
  maximum_attempts: 10,
771
771
  non_retryable_error_types: vec![],
772
772
  },
@@ -799,9 +799,9 @@ mod tests {
799
799
  activity_id: "1".to_string(),
800
800
  attempt: 1,
801
801
  retry_policy: RetryPolicy {
802
- initial_interval: Some(Duration::from_secs(1).into()),
802
+ initial_interval: Some(prost_dur!(from_secs(1))),
803
803
  backoff_coefficient: 10.0,
804
- maximum_interval: Some(Duration::from_secs(10).into()),
804
+ maximum_interval: Some(prost_dur!(from_secs(10))),
805
805
  maximum_attempts: 10,
806
806
  non_retryable_error_types: vec!["TestError".to_string()],
807
807
  },
@@ -843,9 +843,9 @@ mod tests {
843
843
  activity_id: 1.to_string(),
844
844
  attempt: 5,
845
845
  retry_policy: RetryPolicy {
846
- initial_interval: Some(Duration::from_secs(10).into()),
846
+ initial_interval: Some(prost_dur!(from_secs(10))),
847
847
  backoff_coefficient: 1.0,
848
- maximum_interval: Some(Duration::from_secs(10).into()),
848
+ maximum_interval: Some(prost_dur!(from_secs(10))),
849
849
  maximum_attempts: 10,
850
850
  non_retryable_error_types: vec![],
851
851
  },
@@ -892,7 +892,7 @@ mod tests {
892
892
  activity_id: 1.to_string(),
893
893
  attempt: 5,
894
894
  retry_policy: RetryPolicy {
895
- initial_interval: Some(Duration::from_millis(10).into()),
895
+ initial_interval: Some(prost_dur!(from_millis(10))),
896
896
  backoff_coefficient: 1.0,
897
897
  ..Default::default()
898
898
  },
@@ -929,7 +929,7 @@ mod tests {
929
929
  activity_id: 1.to_string(),
930
930
  attempt: 5,
931
931
  retry_policy: RetryPolicy {
932
- initial_interval: Some(Duration::from_millis(10).into()),
932
+ initial_interval: Some(prost_dur!(from_millis(10))),
933
933
  backoff_coefficient: 1.0,
934
934
  ..Default::default()
935
935
  },
@@ -975,7 +975,7 @@ mod tests {
975
975
  activity_id: 1.to_string(),
976
976
  attempt: 5,
977
977
  retry_policy: RetryPolicy {
978
- initial_interval: Some(Duration::from_millis(10).into()),
978
+ initial_interval: Some(prost_dur!(from_millis(10))),
979
979
  backoff_coefficient: 1.0,
980
980
  ..Default::default()
981
981
  },
@@ -12,10 +12,9 @@ use crate::{
12
12
  pollers::BoxedActPoller,
13
13
  telemetry::metrics::{activity_type, activity_worker_type, workflow_type, MetricsContext},
14
14
  worker::{
15
- activities::activity_heartbeat_manager::ActivityHeartbeatError,
16
- client::{WorkerClient, WorkerClientBag},
15
+ activities::activity_heartbeat_manager::ActivityHeartbeatError, client::WorkerClient,
17
16
  },
18
- CompleteActivityError, PollActivityError, TaskToken,
17
+ PollActivityError, TaskToken,
19
18
  };
20
19
  use activity_heartbeat_manager::ActivityHeartbeatManager;
21
20
  use dashmap::DashMap;
@@ -136,7 +135,7 @@ impl WorkerActivityTasks {
136
135
  max_activity_tasks: usize,
137
136
  max_worker_act_per_sec: Option<f64>,
138
137
  poller: BoxedActPoller,
139
- client: Arc<WorkerClientBag>,
138
+ client: Arc<dyn WorkerClient>,
140
139
  metrics: MetricsContext,
141
140
  max_heartbeat_throttle_interval: Duration,
142
141
  default_heartbeat_throttle_interval: Duration,
@@ -232,7 +231,7 @@ impl WorkerActivityTasks {
232
231
  task_token: TaskToken,
233
232
  status: aer::Status,
234
233
  client: &dyn WorkerClient,
235
- ) -> Result<(), CompleteActivityError> {
234
+ ) {
236
235
  if let Some((_, act_info)) = self.outstanding_activity_tasks.remove(&task_token) {
237
236
  let act_metrics = self.metrics.with_new_attrs([
238
237
  activity_type(act_info.base.activity_type.clone()),
@@ -285,7 +284,7 @@ impl WorkerActivityTasks {
285
284
  completion. This may happen if the activity has already been cancelled but \
286
285
  completed anyway.");
287
286
  } else {
288
- return Err(e.into());
287
+ warn!(error=?e, "Network error while completing activity");
289
288
  };
290
289
  };
291
290
  };
@@ -295,7 +294,6 @@ impl WorkerActivityTasks {
295
294
  &task_token
296
295
  );
297
296
  }
298
- Ok(())
299
297
  }
300
298
 
301
299
  /// Attempt to record an activity heartbeat
@@ -446,15 +444,11 @@ mod tests {
446
444
  }
447
445
  .into(),
448
446
  ]);
449
- let client = WorkerClientBag::new(
450
- Box::new(mock_manual_workflow_client()),
451
- "fake_namespace".to_string(),
452
- );
453
447
  let atm = WorkerActivityTasks::new(
454
448
  10,
455
449
  Some(2.0),
456
450
  poller,
457
- Arc::new(client),
451
+ Arc::new(mock_manual_workflow_client()),
458
452
  MetricsContext::default(),
459
453
  Duration::from_secs(1),
460
454
  Duration::from_secs(1),