@temporalio/core-bridge 1.12.0 → 1.12.2
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 +64 -119
- package/Cargo.toml +1 -1
- package/index.js +3 -2
- package/package.json +3 -3
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/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/sdk-core/.cargo/config.toml +1 -2
- package/sdk-core/.github/workflows/per-pr.yml +2 -0
- package/sdk-core/AGENTS.md +7 -0
- package/sdk-core/Cargo.toml +9 -5
- package/sdk-core/README.md +6 -5
- package/sdk-core/client/Cargo.toml +3 -2
- package/sdk-core/client/src/lib.rs +17 -8
- package/sdk-core/client/src/metrics.rs +57 -23
- package/sdk-core/client/src/raw.rs +33 -15
- package/sdk-core/core/Cargo.toml +11 -9
- package/sdk-core/core/benches/workflow_replay.rs +114 -15
- package/sdk-core/core/src/core_tests/activity_tasks.rs +18 -18
- package/sdk-core/core/src/core_tests/child_workflows.rs +4 -4
- package/sdk-core/core/src/core_tests/determinism.rs +6 -6
- package/sdk-core/core/src/core_tests/local_activities.rs +20 -20
- package/sdk-core/core/src/core_tests/mod.rs +40 -5
- package/sdk-core/core/src/core_tests/queries.rs +25 -16
- package/sdk-core/core/src/core_tests/replay_flag.rs +3 -3
- package/sdk-core/core/src/core_tests/updates.rs +3 -3
- package/sdk-core/core/src/core_tests/workers.rs +9 -7
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +40 -42
- package/sdk-core/core/src/ephemeral_server/mod.rs +1 -19
- package/sdk-core/core/src/lib.rs +10 -1
- package/sdk-core/core/src/pollers/poll_buffer.rs +2 -2
- package/sdk-core/core/src/replay/mod.rs +3 -3
- package/sdk-core/core/src/telemetry/metrics.rs +306 -152
- package/sdk-core/core/src/telemetry/mod.rs +11 -4
- package/sdk-core/core/src/telemetry/otel.rs +134 -131
- package/sdk-core/core/src/telemetry/prometheus_meter.rs +885 -0
- package/sdk-core/core/src/telemetry/prometheus_server.rs +48 -28
- package/sdk-core/core/src/test_help/mod.rs +27 -12
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +7 -7
- package/sdk-core/core/src/worker/activities.rs +4 -4
- package/sdk-core/core/src/worker/client/mocks.rs +10 -3
- package/sdk-core/core/src/worker/client.rs +68 -5
- package/sdk-core/core/src/worker/heartbeat.rs +229 -0
- package/sdk-core/core/src/worker/mod.rs +35 -14
- package/sdk-core/core/src/worker/tuner/resource_based.rs +4 -4
- package/sdk-core/core/src/worker/workflow/history_update.rs +71 -19
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/worker/workflow/machines/nexus_operation_state_machine.rs +31 -48
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +3 -3
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +4 -1
- package/sdk-core/core/src/worker/workflow/managed_run.rs +1 -1
- package/sdk-core/core/src/worker/workflow/mod.rs +15 -15
- package/sdk-core/core-api/Cargo.toml +2 -2
- package/sdk-core/core-api/src/envconfig.rs +204 -99
- package/sdk-core/core-api/src/lib.rs +9 -0
- package/sdk-core/core-api/src/telemetry/metrics.rs +548 -100
- package/sdk-core/core-api/src/worker.rs +11 -5
- package/sdk-core/core-c-bridge/Cargo.toml +49 -0
- package/sdk-core/core-c-bridge/build.rs +26 -0
- package/sdk-core/core-c-bridge/include/temporal-sdk-core-c-bridge.h +817 -0
- package/sdk-core/core-c-bridge/src/client.rs +679 -0
- package/sdk-core/core-c-bridge/src/lib.rs +245 -0
- package/sdk-core/core-c-bridge/src/metric.rs +682 -0
- package/sdk-core/core-c-bridge/src/random.rs +61 -0
- package/sdk-core/core-c-bridge/src/runtime.rs +445 -0
- package/sdk-core/core-c-bridge/src/testing.rs +282 -0
- package/sdk-core/core-c-bridge/src/tests/context.rs +644 -0
- package/sdk-core/core-c-bridge/src/tests/mod.rs +178 -0
- package/sdk-core/core-c-bridge/src/tests/utils.rs +108 -0
- package/sdk-core/core-c-bridge/src/worker.rs +1069 -0
- package/sdk-core/etc/deps.svg +64 -64
- package/sdk-core/sdk/src/activity_context.rs +6 -4
- package/sdk-core/sdk/src/lib.rs +49 -27
- package/sdk-core/sdk/src/workflow_future.rs +18 -25
- package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +4 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +0 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +630 -83
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +632 -78
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/batch/v1/message.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +6 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/deployment/v1/message.proto +32 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +10 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/deployment.proto +26 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/reset.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +47 -31
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +7 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/worker/v1/message.proto +134 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +14 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +148 -37
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +21 -0
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -4
- package/sdk-core/sdk-core-protos/src/history_builder.rs +9 -5
- package/sdk-core/sdk-core-protos/src/lib.rs +96 -6
- package/sdk-core/test-utils/src/lib.rs +11 -3
- package/sdk-core/tests/cloud_tests.rs +3 -3
- package/sdk-core/tests/heavy_tests.rs +11 -3
- package/sdk-core/tests/integ_tests/client_tests.rs +12 -13
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/metrics_tests.rs +188 -83
- package/sdk-core/tests/integ_tests/polling_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/queries_tests.rs +56 -40
- package/sdk-core/tests/integ_tests/update_tests.rs +2 -7
- package/sdk-core/tests/integ_tests/worker_tests.rs +3 -4
- package/sdk-core/tests/integ_tests/worker_versioning_tests.rs +3 -7
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +3 -5
- package/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +24 -17
- package/src/client.rs +6 -0
- package/src/metrics.rs +6 -6
|
@@ -86,8 +86,8 @@ pub(super) enum NexusOperationCommand {
|
|
|
86
86
|
Start { operation_token: String },
|
|
87
87
|
#[display("StartSync")]
|
|
88
88
|
StartSync,
|
|
89
|
-
#[display("
|
|
90
|
-
|
|
89
|
+
#[display("FailBeforeStart")]
|
|
90
|
+
FailBeforeStart(Failure),
|
|
91
91
|
#[display("Complete")]
|
|
92
92
|
Complete(Option<Payload>),
|
|
93
93
|
#[display("Fail")]
|
|
@@ -174,7 +174,9 @@ impl ScheduleCommandCreated {
|
|
|
174
174
|
state: &mut SharedState,
|
|
175
175
|
) -> NexusOperationMachineTransition<Cancelled> {
|
|
176
176
|
state.cancelled_before_sent = true;
|
|
177
|
-
NexusOperationMachineTransition::commands([NexusOperationCommand::
|
|
177
|
+
NexusOperationMachineTransition::commands([NexusOperationCommand::FailBeforeStart(
|
|
178
|
+
state.cancelled_failure("Nexus Operation cancelled before scheduled".to_owned()),
|
|
179
|
+
)])
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
|
|
@@ -208,40 +210,37 @@ impl ScheduledEventRecorded {
|
|
|
208
210
|
self,
|
|
209
211
|
fa: NexusOperationFailedEventAttributes,
|
|
210
212
|
) -> NexusOperationMachineTransition<Failed> {
|
|
211
|
-
NexusOperationMachineTransition::commands([
|
|
212
|
-
|
|
213
|
-
NexusOperationCommand::Fail(fa.failure.unwrap_or_else(|| Failure {
|
|
213
|
+
NexusOperationMachineTransition::commands([NexusOperationCommand::FailBeforeStart(
|
|
214
|
+
fa.failure.unwrap_or_else(|| Failure {
|
|
214
215
|
message: "Nexus operation failed but failure field was not populated".to_owned(),
|
|
215
216
|
..Default::default()
|
|
216
|
-
})
|
|
217
|
-
])
|
|
217
|
+
}),
|
|
218
|
+
)])
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
pub(super) fn on_canceled(
|
|
221
222
|
self,
|
|
222
223
|
ca: NexusOperationCanceledEventAttributes,
|
|
223
224
|
) -> NexusOperationMachineTransition<Cancelled> {
|
|
224
|
-
NexusOperationMachineTransition::commands([
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
"Nexus operation was cancelled but failure field was not populated".to_owned(),
|
|
225
|
+
NexusOperationMachineTransition::commands([NexusOperationCommand::FailBeforeStart(
|
|
226
|
+
ca.failure.unwrap_or_else(|| Failure {
|
|
227
|
+
message: "Nexus operation was cancelled but failure field was not populated"
|
|
228
|
+
.to_owned(),
|
|
229
229
|
..Default::default()
|
|
230
|
-
})
|
|
231
|
-
])
|
|
230
|
+
}),
|
|
231
|
+
)])
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
pub(super) fn on_timed_out(
|
|
235
235
|
self,
|
|
236
236
|
toa: NexusOperationTimedOutEventAttributes,
|
|
237
237
|
) -> NexusOperationMachineTransition<TimedOut> {
|
|
238
|
-
NexusOperationMachineTransition::commands([
|
|
239
|
-
|
|
240
|
-
NexusOperationCommand::TimedOut(toa.failure.unwrap_or_else(|| Failure {
|
|
238
|
+
NexusOperationMachineTransition::commands([NexusOperationCommand::FailBeforeStart(
|
|
239
|
+
toa.failure.unwrap_or_else(|| Failure {
|
|
241
240
|
message: "Nexus operation timed out but failure field was not populated".to_owned(),
|
|
242
241
|
..Default::default()
|
|
243
|
-
})
|
|
244
|
-
])
|
|
242
|
+
}),
|
|
243
|
+
)])
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
pub(super) fn on_started(
|
|
@@ -491,30 +490,15 @@ impl WFMachinesAdapter for NexusOperationMachine {
|
|
|
491
490
|
.into(),
|
|
492
491
|
]
|
|
493
492
|
}
|
|
494
|
-
NexusOperationCommand::
|
|
493
|
+
NexusOperationCommand::FailBeforeStart(failure) => {
|
|
495
494
|
vec![
|
|
496
495
|
ResolveNexusOperationStart {
|
|
497
496
|
seq: self.shared_state.lang_seq_num,
|
|
498
|
-
status: Some(resolve_nexus_operation_start::Status::
|
|
499
|
-
|
|
500
|
-
"Nexus Operation cancelled before scheduled".to_owned(),
|
|
501
|
-
&self.shared_state.operation_token,
|
|
502
|
-
),
|
|
497
|
+
status: Some(resolve_nexus_operation_start::Status::Failed(
|
|
498
|
+
failure.clone(),
|
|
503
499
|
)),
|
|
504
500
|
}
|
|
505
501
|
.into(),
|
|
506
|
-
ResolveNexusOperation {
|
|
507
|
-
seq: self.shared_state.lang_seq_num,
|
|
508
|
-
result: Some(NexusOperationResult {
|
|
509
|
-
status: Some(nexus_operation_result::Status::Cancelled(
|
|
510
|
-
self.cancelled_failure(
|
|
511
|
-
"Nexus Operation cancelled before scheduled".to_owned(),
|
|
512
|
-
&self.shared_state.operation_token,
|
|
513
|
-
),
|
|
514
|
-
)),
|
|
515
|
-
}),
|
|
516
|
-
}
|
|
517
|
-
.into(),
|
|
518
502
|
]
|
|
519
503
|
}
|
|
520
504
|
NexusOperationCommand::Complete(c) => {
|
|
@@ -586,9 +570,8 @@ impl WFMachinesAdapter for NexusOperationMachine {
|
|
|
586
570
|
seq: self.shared_state.lang_seq_num,
|
|
587
571
|
result: Some(NexusOperationResult {
|
|
588
572
|
status: Some(nexus_operation_result::Status::Cancelled(
|
|
589
|
-
self.cancelled_failure(
|
|
573
|
+
self.shared_state.cancelled_failure(
|
|
590
574
|
"Nexus operation cancelled after starting".to_owned(),
|
|
591
|
-
&self.shared_state.operation_token,
|
|
592
575
|
),
|
|
593
576
|
)),
|
|
594
577
|
}),
|
|
@@ -614,8 +597,8 @@ impl TryFrom<CommandType> for NexusOperationMachineEvents {
|
|
|
614
597
|
}
|
|
615
598
|
}
|
|
616
599
|
|
|
617
|
-
impl
|
|
618
|
-
fn cancelled_failure(&self, message: String
|
|
600
|
+
impl SharedState {
|
|
601
|
+
fn cancelled_failure(&self, message: String) -> Failure {
|
|
619
602
|
Failure {
|
|
620
603
|
message,
|
|
621
604
|
cause: Some(Box::new(Failure {
|
|
@@ -624,12 +607,12 @@ impl NexusOperationMachine {
|
|
|
624
607
|
})),
|
|
625
608
|
failure_info: Some(FailureInfo::NexusOperationExecutionFailureInfo(
|
|
626
609
|
failure::NexusOperationFailureInfo {
|
|
627
|
-
scheduled_event_id: self.
|
|
628
|
-
endpoint: self.
|
|
629
|
-
service: self.
|
|
630
|
-
operation: self.
|
|
631
|
-
|
|
632
|
-
|
|
610
|
+
scheduled_event_id: self.scheduled_event_id,
|
|
611
|
+
endpoint: self.endpoint.clone(),
|
|
612
|
+
service: self.service.clone(),
|
|
613
|
+
operation: self.operation.clone(),
|
|
614
|
+
operation_token: self.operation_token.clone().unwrap_or_default(),
|
|
615
|
+
..Default::default()
|
|
633
616
|
},
|
|
634
617
|
)),
|
|
635
618
|
..Default::default()
|
|
@@ -104,9 +104,8 @@ pub(super) fn new_external_signal(
|
|
|
104
104
|
},
|
|
105
105
|
signal_name: attrs.signal_name,
|
|
106
106
|
input: attrs.args.into_payloads(),
|
|
107
|
-
// Is deprecated
|
|
108
|
-
control: "".to_string(),
|
|
109
107
|
child_workflow_only: only_child,
|
|
108
|
+
..Default::default()
|
|
110
109
|
},
|
|
111
110
|
);
|
|
112
111
|
Ok(NewMachineWithCommand {
|
package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs
CHANGED
|
@@ -183,7 +183,7 @@ mod tests {
|
|
|
183
183
|
replay::TestHistoryBuilder,
|
|
184
184
|
test_help::{MockPollCfg, ResponseType, build_fake_sdk, build_mock_pollers, mock_worker},
|
|
185
185
|
worker::{
|
|
186
|
-
client::mocks::
|
|
186
|
+
client::mocks::mock_worker_client,
|
|
187
187
|
workflow::machines::patch_state_machine::VERSION_SEARCH_ATTR_KEY,
|
|
188
188
|
},
|
|
189
189
|
};
|
|
@@ -319,7 +319,7 @@ mod tests {
|
|
|
319
319
|
if with_patched_cmd {
|
|
320
320
|
t.add_has_change_marker(&patch_id, false);
|
|
321
321
|
}
|
|
322
|
-
t.add_upsert_search_attrs_for_patch(&
|
|
322
|
+
t.add_upsert_search_attrs_for_patch(std::slice::from_ref(&patch_id));
|
|
323
323
|
t.add_we_signaled("hi", vec![]);
|
|
324
324
|
t.add_full_wf_task();
|
|
325
325
|
t.add_workflow_execution_completed();
|
|
@@ -328,7 +328,7 @@ mod tests {
|
|
|
328
328
|
"fakeid",
|
|
329
329
|
t,
|
|
330
330
|
[ResponseType::ToTaskNum(1), ResponseType::ToTaskNum(2)],
|
|
331
|
-
|
|
331
|
+
mock_worker_client(),
|
|
332
332
|
);
|
|
333
333
|
// Ensure the upsert command has an empty map when not using the patched command
|
|
334
334
|
if !with_patched_cmd {
|
|
@@ -395,7 +395,7 @@ impl WorkflowMachines {
|
|
|
395
395
|
self.current_started_event_id
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
pub(crate) fn prepare_for_wft_response(&mut self) -> MachinesWFTResponseContent {
|
|
398
|
+
pub(crate) fn prepare_for_wft_response(&mut self) -> MachinesWFTResponseContent<'_> {
|
|
399
399
|
MachinesWFTResponseContent {
|
|
400
400
|
replaying: self.replaying,
|
|
401
401
|
has_pending_jobs: self.has_pending_jobs(),
|
|
@@ -839,6 +839,9 @@ impl WorkflowMachines {
|
|
|
839
839
|
if event.is_final_wf_execution_event() {
|
|
840
840
|
self.have_seen_terminal_event = true;
|
|
841
841
|
}
|
|
842
|
+
if event.is_ignorable() {
|
|
843
|
+
return Ok(EventHandlingOutcome::Normal);
|
|
844
|
+
}
|
|
842
845
|
if matches!(
|
|
843
846
|
event.event_type(),
|
|
844
847
|
EventType::WorkflowExecutionTerminated | EventType::WorkflowExecutionTimedOut
|
|
@@ -1441,7 +1441,7 @@ impl WorkflowManager {
|
|
|
1441
1441
|
|
|
1442
1442
|
/// Must be called when we're ready to respond to a WFT after handling catching up on replay
|
|
1443
1443
|
/// and handling all activation completions from lang.
|
|
1444
|
-
fn prepare_for_wft_response(&mut self) -> MachinesWFTResponseContent {
|
|
1444
|
+
fn prepare_for_wft_response(&mut self) -> MachinesWFTResponseContent<'_> {
|
|
1445
1445
|
self.machines.prepare_for_wft_response()
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
@@ -22,15 +22,13 @@ use crate::{
|
|
|
22
22
|
},
|
|
23
23
|
internal_flags::InternalFlags,
|
|
24
24
|
pollers::TrackedPermittedTqResp,
|
|
25
|
-
protosext::{
|
|
26
|
-
ValidPollWFTQResponse, legacy_query_failure, protocol_messages::IncomingProtocolMessage,
|
|
27
|
-
},
|
|
25
|
+
protosext::{ValidPollWFTQResponse, protocol_messages::IncomingProtocolMessage},
|
|
28
26
|
telemetry::{TelemetryInstance, VecDisplayer, set_trace_subscriber_for_current_thread},
|
|
29
27
|
worker::{
|
|
30
28
|
LocalActRequest, LocalActivityExecutionResult, LocalActivityResolution,
|
|
31
29
|
PostActivateHookData,
|
|
32
30
|
activities::{ActivitiesFromWFTsHandle, LocalActivityManager},
|
|
33
|
-
client::{WorkerClient, WorkflowTaskCompletion},
|
|
31
|
+
client::{LegacyQueryResult, WorkerClient, WorkflowTaskCompletion},
|
|
34
32
|
workflow::{
|
|
35
33
|
history_update::HistoryPaginator,
|
|
36
34
|
managed_run::RunUpdateAct,
|
|
@@ -50,7 +48,6 @@ use std::{
|
|
|
50
48
|
collections::VecDeque,
|
|
51
49
|
fmt::Debug,
|
|
52
50
|
future::Future,
|
|
53
|
-
mem,
|
|
54
51
|
ops::DerefMut,
|
|
55
52
|
rc::Rc,
|
|
56
53
|
result,
|
|
@@ -408,10 +405,9 @@ impl Workflows {
|
|
|
408
405
|
),
|
|
409
406
|
force_cause: 0,
|
|
410
407
|
};
|
|
411
|
-
// TODO: tim - Update workflow cause when API is ready
|
|
412
408
|
let new_outcome = FailedActivationWFTReport::Report(
|
|
413
409
|
task_token,
|
|
414
|
-
WorkflowTaskFailedCause::
|
|
410
|
+
WorkflowTaskFailedCause::GrpcMessageTooLarge,
|
|
415
411
|
failure,
|
|
416
412
|
);
|
|
417
413
|
self.handle_activation_failed(run_id, completion_time, new_outcome)
|
|
@@ -434,7 +430,8 @@ impl Workflows {
|
|
|
434
430
|
task_token,
|
|
435
431
|
action: ActivationAction::RespondLegacyQuery { result },
|
|
436
432
|
} => {
|
|
437
|
-
self.respond_legacy_query(task_token, *result)
|
|
433
|
+
self.respond_legacy_query(task_token, LegacyQueryResult::Succeeded(*result))
|
|
434
|
+
.await;
|
|
438
435
|
WFTReportStatus::Reported {
|
|
439
436
|
reset_last_started_to: None,
|
|
440
437
|
completion_time,
|
|
@@ -465,7 +462,7 @@ impl Workflows {
|
|
|
465
462
|
}
|
|
466
463
|
FailedActivationWFTReport::ReportLegacyQueryFailure(task_token, failure) => {
|
|
467
464
|
warn!(run_id=%run_id, failure=?failure, "Failing legacy query request");
|
|
468
|
-
self.respond_legacy_query(task_token,
|
|
465
|
+
self.respond_legacy_query(task_token, LegacyQueryResult::Failed(failure))
|
|
469
466
|
.await;
|
|
470
467
|
WFTReportStatus::Reported {
|
|
471
468
|
reset_last_started_to: None,
|
|
@@ -808,7 +805,7 @@ impl Workflows {
|
|
|
808
805
|
}
|
|
809
806
|
|
|
810
807
|
/// Wraps responding to legacy queries. Handles ignore-able failures.
|
|
811
|
-
async fn respond_legacy_query(&self, tt: TaskToken, res:
|
|
808
|
+
async fn respond_legacy_query(&self, tt: TaskToken, res: LegacyQueryResult) {
|
|
812
809
|
match self.client.respond_legacy_query(tt, res).await {
|
|
813
810
|
Ok(_) => {}
|
|
814
811
|
Err(e) if e.code() == tonic::Code::NotFound => {
|
|
@@ -1100,8 +1097,7 @@ struct BufferedTasks {
|
|
|
1100
1097
|
/// current one has been processed).
|
|
1101
1098
|
query_only_tasks: VecDeque<PermittedWFT>,
|
|
1102
1099
|
/// These are query-only tasks for the *buffered* wft, if any. They will all be discarded if
|
|
1103
|
-
/// a buffered wft is replaced before being handled.
|
|
1104
|
-
/// buffered task is taken.
|
|
1100
|
+
/// a buffered wft is replaced before being handled.
|
|
1105
1101
|
query_only_tasks_for_buffered: VecDeque<PermittedWFT>,
|
|
1106
1102
|
}
|
|
1107
1103
|
|
|
@@ -1136,9 +1132,13 @@ impl BufferedTasks {
|
|
|
1136
1132
|
if let Some(q) = self.query_only_tasks.pop_front() {
|
|
1137
1133
|
return Some(q);
|
|
1138
1134
|
}
|
|
1139
|
-
if
|
|
1140
|
-
|
|
1141
|
-
|
|
1135
|
+
if self.wft.is_some() {
|
|
1136
|
+
if let Some(q) = self.query_only_tasks_for_buffered.pop_front() {
|
|
1137
|
+
return Some(q);
|
|
1138
|
+
}
|
|
1139
|
+
if let Some(t) = self.wft.take() {
|
|
1140
|
+
return Some(t);
|
|
1141
|
+
}
|
|
1142
1142
|
}
|
|
1143
1143
|
None
|
|
1144
1144
|
}
|
|
@@ -14,10 +14,9 @@ categories = ["development-tools"]
|
|
|
14
14
|
|
|
15
15
|
[features]
|
|
16
16
|
otel_impls = ["dep:opentelemetry"]
|
|
17
|
-
envconfig = ["dep:toml", "dep:serde", "dep:dirs"
|
|
17
|
+
envconfig = ["dep:toml", "dep:serde", "dep:dirs"]
|
|
18
18
|
|
|
19
19
|
[dependencies]
|
|
20
|
-
anyhow = { version = "1.0", optional = true }
|
|
21
20
|
async-trait = "0.1"
|
|
22
21
|
dirs = { version = "5.0", optional = true }
|
|
23
22
|
derive_builder = { workspace = true }
|
|
@@ -29,6 +28,7 @@ serde_json = "1.0"
|
|
|
29
28
|
thiserror = { workspace = true }
|
|
30
29
|
toml = { version = "0.8", optional = true }
|
|
31
30
|
tonic = { workspace = true }
|
|
31
|
+
tracing = "0.1"
|
|
32
32
|
tracing-core = "0.1"
|
|
33
33
|
url = "2.3"
|
|
34
34
|
|