@temporalio/core-bridge 1.13.2 → 1.14.0
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 +135 -100
- package/Cargo.toml +3 -2
- package/{sdk-core/fsm/rustfsm_trait/LICENSE.txt → LICENSE} +5 -5
- package/README.md +0 -1
- package/bridge-macros/Cargo.toml +16 -0
- package/bridge-macros/src/derive_js_function.rs +126 -0
- package/bridge-macros/src/derive_tryfromjs.rs +138 -0
- package/bridge-macros/src/derive_tryintojs.rs +151 -0
- package/bridge-macros/src/lib.rs +42 -0
- package/lib/native.d.ts +13 -6
- package/package.json +6 -5
- 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 +9 -3
- package/sdk-core/.github/workflows/per-pr.yml +42 -5
- package/sdk-core/AGENTS.md +17 -19
- package/sdk-core/Cargo.toml +6 -7
- package/sdk-core/README.md +12 -15
- package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
- package/sdk-core/{client → crates/client}/Cargo.toml +7 -9
- package/sdk-core/{client → crates/client}/src/lib.rs +110 -159
- package/sdk-core/{client → crates/client}/src/metrics.rs +1 -1
- package/sdk-core/{client → crates/client}/src/raw.rs +73 -44
- package/sdk-core/crates/client/src/request_extensions.rs +40 -0
- package/sdk-core/{client → crates/client}/src/retry.rs +24 -17
- package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
- package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +4 -4
- package/sdk-core/{core-api → crates/common}/Cargo.toml +17 -8
- package/sdk-core/crates/common/protos/api_cloud_upstream/VERSION +1 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +18 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +38 -11
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +21 -4
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +6 -6
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +22 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/create-release.yml +5 -0
- package/sdk-core/{core-api → crates/common}/src/envconfig.rs +2 -2
- package/sdk-core/{core-api → crates/common}/src/errors.rs +8 -1
- package/sdk-core/{fsm/rustfsm_trait/src/lib.rs → crates/common/src/fsm_trait.rs} +1 -27
- package/sdk-core/{core-api → crates/common}/src/lib.rs +24 -9
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/canned_histories.rs +1 -1
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +1 -1
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_info.rs +2 -2
- package/sdk-core/{sdk-core-protos/src/lib.rs → crates/common/src/protos/mod.rs} +18 -17
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/test_utils.rs +1 -1
- package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +447 -50
- package/sdk-core/{core-api → crates/common}/src/telemetry.rs +3 -1
- package/sdk-core/{core-api → crates/common}/src/worker.rs +112 -18
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +129 -0
- package/sdk-core/crates/macros/Cargo.toml +23 -0
- package/sdk-core/{fsm/rustfsm_procmacro → crates/macros}/src/lib.rs +6 -11
- package/sdk-core/{sdk → crates/sdk}/Cargo.toml +10 -10
- package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +8 -6
- package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +1 -1
- package/sdk-core/{sdk → crates/sdk}/src/lib.rs +42 -37
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +2 -2
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
- package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/Cargo.toml +32 -25
- package/sdk-core/{tests → crates/sdk-core/benches}/workflow_replay_bench.rs +10 -10
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +32 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelExternalMachine_Coverage.puml +9 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ChildWorkflowMachine_Coverage.puml +27 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CompleteWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ContinueAsNewWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/FailWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/LocalActivityMachine_Coverage.puml +23 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ModifyWorkflowPropertiesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/PatchMachine_Coverage.puml +8 -0
- package/sdk-core/crates/sdk-core/machine_coverage/SignalExternalMachine_Coverage.puml +12 -0
- package/sdk-core/crates/sdk-core/machine_coverage/TimerMachine_Coverage.puml +13 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpdateMachine_Coverage.puml +19 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpsertSearchAttributesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/WorkflowTaskMachine_Coverage.puml +11 -0
- package/sdk-core/{core → crates/sdk-core}/src/abstractions.rs +62 -6
- package/sdk-core/crates/sdk-core/src/antithesis.rs +60 -0
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/activity_tasks.rs +36 -31
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +12 -9
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +24 -21
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +10 -8
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +17 -15
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -17
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +126 -39
- package/sdk-core/{core → crates/sdk-core}/src/debug_client.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/ephemeral_server/mod.rs +3 -3
- package/sdk-core/crates/sdk-core/src/histfetch.rs +33 -0
- package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +4 -3
- package/sdk-core/{core → crates/sdk-core}/src/lib.rs +85 -43
- package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +8 -6
- package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +51 -16
- package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
- package/sdk-core/{core → crates/sdk-core}/src/retry_logic.rs +19 -1
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/log_export.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/metrics.rs +80 -34
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +4 -4
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/otel.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_meter.rs +13 -13
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/test_help/integ_helpers.rs +127 -40
- package/sdk-core/{core → crates/sdk-core}/src/test_help/unit_helpers.rs +13 -11
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +14 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +21 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +25 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +164 -71
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +246 -0
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1462 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/nexus.rs +15 -14
- package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +12 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/fixed_size.rs +5 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/resource_based.rs +453 -57
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner.rs +21 -4
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/driven_workflow.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/history_update.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -9
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +31 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -8
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/local_activity_state_machine.rs +33 -30
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/mod.rs +22 -17
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -3
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +20 -22
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/patch_state_machine.rs +12 -11
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +26 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/transition_coverage.rs +1 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/update_state_machine.rs +19 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +20 -18
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines.rs +61 -70
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/managed_run.rs +55 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/mod.rs +166 -60
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/run_cache.rs +10 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_extraction.rs +4 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_poller.rs +15 -4
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/workflow_stream.rs +30 -16
- package/sdk-core/{tests → crates/sdk-core/tests}/c_bridge_smoke_test.c +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/cloud_tests.rs +1 -1
- package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/common/http_proxy.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/common/mod.rs +93 -74
- package/sdk-core/{tests → crates/sdk-core/tests}/common/workflows.rs +4 -3
- package/sdk-core/crates/sdk-core/tests/fsm_procmacro.rs +6 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dupe_transitions_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/dupe_transitions_fail.stderr +12 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dynamic_dest_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.rs +1 -3
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.stderr +4 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_arg_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/medium_complex_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/no_handle_conversions_require_into_fail.rs +2 -4
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/no_handle_conversions_require_into_fail.stderr +15 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/simple_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/struct_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/struct_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_more_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_zero_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/global_metric_tests.rs +14 -15
- package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +3 -3
- package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +19 -12
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/activity_functions.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/client_tests.rs +16 -111
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +5 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +23 -19
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +134 -60
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/pagination_tests.rs +4 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/polling_tests.rs +37 -36
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +12 -10
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +41 -29
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +24 -19
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_tests.rs +113 -51
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +19 -17
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +35 -30
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +3 -3
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_external.rs +14 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_wf.rs +13 -8
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/child_workflows.rs +48 -35
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/continue_as_new.rs +14 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/determinism.rs +24 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +9 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/local_activities.rs +47 -47
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/modify_wf_properties.rs +16 -11
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +51 -23
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/patches.rs +22 -10
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +19 -17
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +14 -5
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/signals.rs +24 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +8 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/timers.rs +28 -18
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +18 -13
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +46 -41
- package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +15 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +20 -14
- package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +2 -2
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +10 -5
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +5 -5
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/Cargo.toml +13 -10
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +32 -23
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +55 -32
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/envconfig.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/metric.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/runtime.rs +24 -9
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +11 -10
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +7 -7
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +3 -4
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +111 -58
- package/sdk-core/docker-cgroup-tests.sh +24 -0
- package/sdk-core/{docker → etc/docker}/docker-compose-ci.yaml +9 -9
- package/sdk-core/{docker → etc/docker}/docker-compose-telem.yaml +11 -11
- package/sdk-core/{docker → etc/docker}/docker-compose.yaml +8 -8
- package/sdk-core/{integ-with-otel.sh → etc/integ-with-otel.sh} +1 -1
- package/sdk-core/etc/regen-depgraph.sh +2 -2
- package/src/client.rs +24 -33
- package/src/helpers/try_from_js.rs +1 -1
- package/src/logs.rs +1 -1
- package/src/metrics.rs +3 -3
- package/src/runtime.rs +42 -28
- package/src/testing.rs +3 -3
- package/src/worker.rs +70 -36
- package/ts/native.ts +13 -6
- package/LICENSE.md +0 -23
- package/sdk-core/client/src/worker_registry/mod.rs +0 -282
- package/sdk-core/core/src/worker/heartbeat.rs +0 -230
- package/sdk-core/core/src/worker/mod.rs +0 -990
- package/sdk-core/etc/deps.svg +0 -162
- package/sdk-core/fsm/Cargo.toml +0 -21
- package/sdk-core/fsm/README.md +0 -3
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
- package/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +0 -21
- package/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -15
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
- package/sdk-core/fsm/src/lib.rs +0 -2
- package/sdk-core/sdk-core-protos/Cargo.toml +0 -37
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +0 -1
- /package/sdk-core/{client → crates/client}/src/callback_based.rs +0 -0
- /package/sdk-core/{client → crates/client}/src/proxy.rs +0 -0
- /package/sdk-core/{client → crates/client}/src/replaceable.rs +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/build.rs +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/build.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/connectivityrule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/ci.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/publish-docs.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/annotations.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/http.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/any.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/descriptor.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/duration.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/empty.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/struct.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/timestamp.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/wrappers.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv2.json +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/payload_description.txt +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/activity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/command/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/common/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/deployment.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/export/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/history/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/namespace/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/query/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/rules/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/worker_config.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/update/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/version/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/worker/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/google/rpc/status.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/grpc/health/v1/health.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/common/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/core_interface.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/nexus/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/constants.rs +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/task_token.rs +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +0 -0
- /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
- /package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/test_help/mod.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/worker/slot_supplier.rs +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/ends_empty_wft_complete.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-16_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-23_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-85_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/fail_wf_task.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-0_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-1_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-2_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-3_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/old_change_marker_format.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/timer_workflow_history.bin +0 -0
- /package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/priority.rs +0 -0
- /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/build.rs +0 -0
- /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +0 -0
- /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
|
@@ -25,7 +25,7 @@ use crate::{
|
|
|
25
25
|
workflow::{
|
|
26
26
|
CommandID, DrivenWorkflow, HistoryUpdate, InternalFlagsRef, LocalResolution,
|
|
27
27
|
OutgoingJob, RunBasics, WFCommand, WFCommandVariant, WFMachinesError,
|
|
28
|
-
WorkflowStartedInfo,
|
|
28
|
+
WorkflowStartedInfo, fatal,
|
|
29
29
|
history_update::NextWFT,
|
|
30
30
|
machines::{
|
|
31
31
|
HistEventData, activity_state_machine::ActivityMachine,
|
|
@@ -35,6 +35,7 @@ use crate::{
|
|
|
35
35
|
update_state_machine::UpdateMachine,
|
|
36
36
|
upsert_search_attributes_state_machine::upsert_search_attrs_internal,
|
|
37
37
|
},
|
|
38
|
+
nondeterminism,
|
|
38
39
|
},
|
|
39
40
|
},
|
|
40
41
|
};
|
|
@@ -51,25 +52,27 @@ use std::{
|
|
|
51
52
|
sync::Arc,
|
|
52
53
|
time::{Duration, Instant, SystemTime},
|
|
53
54
|
};
|
|
54
|
-
use
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
use temporalio_common::{
|
|
56
|
+
protos::{
|
|
57
|
+
VERSION_SEARCH_ATTR_KEY,
|
|
58
|
+
coresdk::{
|
|
59
|
+
common::{NamespacedWorkflowExecution, VersioningIntent},
|
|
60
|
+
workflow_activation::{
|
|
61
|
+
self, NotifyHasPatch, UpdateRandomSeed, WorkflowActivation, workflow_activation_job,
|
|
62
|
+
},
|
|
63
|
+
workflow_commands::ContinueAsNewWorkflowExecution,
|
|
61
64
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
temporal::api::{
|
|
66
|
+
command::v1::{
|
|
67
|
+
Command as ProtoCommand, CommandAttributesExt, command::Attributes as ProtoCmdAttrs,
|
|
68
|
+
},
|
|
69
|
+
enums::v1::EventType,
|
|
70
|
+
history::v1::{HistoryEvent, history_event},
|
|
71
|
+
protocol::v1::{Message as ProtocolMessage, message::SequencingId},
|
|
72
|
+
sdk::v1::{UserMetadata, WorkflowTaskCompletedMetadata},
|
|
67
73
|
},
|
|
68
|
-
enums::v1::EventType,
|
|
69
|
-
history::v1::{HistoryEvent, history_event},
|
|
70
|
-
protocol::v1::{Message as ProtocolMessage, message::SequencingId},
|
|
71
|
-
sdk::v1::{UserMetadata, WorkflowTaskCompletedMetadata},
|
|
72
74
|
},
|
|
75
|
+
worker::{WorkerConfig, WorkerDeploymentVersion},
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
type Result<T, E = WFMachinesError> = std::result::Result<T, E>;
|
|
@@ -244,11 +247,11 @@ macro_rules! cancel_machine {
|
|
|
244
247
|
let machine = if let Machines::$machine_variant(m) = $self.machine_mut(m_key) {
|
|
245
248
|
m
|
|
246
249
|
} else {
|
|
247
|
-
return Err(
|
|
250
|
+
return Err(nondeterminism!(
|
|
248
251
|
"Machine was not a {} when it should have been during cancellation: {:?}",
|
|
249
252
|
stringify!($machine_variant),
|
|
250
253
|
$cmd_id
|
|
251
|
-
))
|
|
254
|
+
));
|
|
252
255
|
};
|
|
253
256
|
let machine_resps = machine.$cancel_method($($args),*)?;
|
|
254
257
|
$self.process_machine_responses(m_key, machine_resps)?
|
|
@@ -364,10 +367,10 @@ impl WorkflowMachines {
|
|
|
364
367
|
}
|
|
365
368
|
self.process_machine_responses(mk, resps)?;
|
|
366
369
|
} else {
|
|
367
|
-
return Err(
|
|
370
|
+
return Err(nondeterminism!(
|
|
368
371
|
"Command matching activity with seq num {seq} existed but was not a \
|
|
369
372
|
local activity!"
|
|
370
|
-
))
|
|
373
|
+
));
|
|
371
374
|
}
|
|
372
375
|
self.local_activity_data.done_executing(seq);
|
|
373
376
|
}
|
|
@@ -571,10 +574,9 @@ impl WorkflowMachines {
|
|
|
571
574
|
(evts, has_final_event)
|
|
572
575
|
}
|
|
573
576
|
NextWFT::NeedFetch => {
|
|
574
|
-
return Err(
|
|
577
|
+
return Err(fatal!(
|
|
575
578
|
"Need to fetch history events to continue applying workflow task, but this \
|
|
576
579
|
should be prevented ahead of time! This is a Core SDK bug."
|
|
577
|
-
.to_string(),
|
|
578
580
|
));
|
|
579
581
|
}
|
|
580
582
|
};
|
|
@@ -647,10 +649,11 @@ impl WorkflowMachines {
|
|
|
647
649
|
while let Some(event) = history.next() {
|
|
648
650
|
let eid = event.event_id;
|
|
649
651
|
if eid != self.last_processed_event + 1 {
|
|
650
|
-
return Err(
|
|
652
|
+
return Err(fatal!(
|
|
651
653
|
"History is out of order. Last processed event: {}, event id: {}",
|
|
652
|
-
self.last_processed_event,
|
|
653
|
-
|
|
654
|
+
self.last_processed_event,
|
|
655
|
+
eid
|
|
656
|
+
));
|
|
654
657
|
}
|
|
655
658
|
let next_event = history.peek();
|
|
656
659
|
|
|
@@ -780,9 +783,7 @@ impl WorkflowMachines {
|
|
|
780
783
|
self.local_activity_data.insert_peeked_marker(la_dat);
|
|
781
784
|
}
|
|
782
785
|
} else {
|
|
783
|
-
return Err(
|
|
784
|
-
"Local activity marker was unparsable: {e:?}"
|
|
785
|
-
)));
|
|
786
|
+
return Err(fatal!("Local activity marker was unparsable: {e:?}"));
|
|
786
787
|
}
|
|
787
788
|
} else if let Some(
|
|
788
789
|
history_event::Attributes::WorkflowExecutionUpdateAcceptedEventAttributes(ref atts),
|
|
@@ -854,10 +855,9 @@ impl WorkflowMachines {
|
|
|
854
855
|
let are_more_events =
|
|
855
856
|
next_event.is_some() || !event_dat.current_task_is_last_in_history;
|
|
856
857
|
return if are_more_events {
|
|
857
|
-
Err(
|
|
858
|
+
Err(fatal!(
|
|
858
859
|
"Machines were fed a history which has an event after workflow execution was \
|
|
859
860
|
terminated!"
|
|
860
|
-
.to_string(),
|
|
861
861
|
))
|
|
862
862
|
} else {
|
|
863
863
|
Ok(EventHandlingOutcome::Normal)
|
|
@@ -865,9 +865,9 @@ impl WorkflowMachines {
|
|
|
865
865
|
}
|
|
866
866
|
if event.event_type() == EventType::Unspecified || event.attributes.is_none() {
|
|
867
867
|
return if !event.worker_may_ignore {
|
|
868
|
-
Err(
|
|
868
|
+
Err(fatal!(
|
|
869
869
|
"Event type is unspecified! This history is invalid. Event detail: {event:?}"
|
|
870
|
-
))
|
|
870
|
+
))
|
|
871
871
|
} else {
|
|
872
872
|
debug!("Event is ignorable");
|
|
873
873
|
Ok(EventHandlingOutcome::SkipEvent {
|
|
@@ -892,10 +892,10 @@ impl WorkflowMachines {
|
|
|
892
892
|
.machines_by_event_id
|
|
893
893
|
.get(&initial_cmd_id)
|
|
894
894
|
.ok_or_else(|| {
|
|
895
|
-
|
|
895
|
+
nondeterminism!(
|
|
896
896
|
"During event handling, this event had an initial command ID but we \
|
|
897
897
|
could not find a matching command for it: {event:?}"
|
|
898
|
-
)
|
|
898
|
+
)
|
|
899
899
|
})?;
|
|
900
900
|
self.submachine_handle_event(*mkey, event_dat)?;
|
|
901
901
|
} else {
|
|
@@ -922,9 +922,9 @@ impl WorkflowMachines {
|
|
|
922
922
|
let event = &event_dat.event;
|
|
923
923
|
|
|
924
924
|
if event.is_local_activity_marker() {
|
|
925
|
-
let deets = event
|
|
926
|
-
|
|
927
|
-
|
|
925
|
+
let deets = event
|
|
926
|
+
.extract_local_activity_marker_data()
|
|
927
|
+
.ok_or_else(|| fatal!("Local activity marker was unparsable: {event:?}"))?;
|
|
928
928
|
let cmdid = CommandID::LocalActivity(deets.seq);
|
|
929
929
|
let mkey = self.get_machine_key(cmdid)?;
|
|
930
930
|
if let Machines::LocalActivityMachine(lam) = self.machine(mkey) {
|
|
@@ -933,10 +933,10 @@ impl WorkflowMachines {
|
|
|
933
933
|
return Ok(EventHandlingOutcome::Normal);
|
|
934
934
|
}
|
|
935
935
|
} else {
|
|
936
|
-
return Err(
|
|
936
|
+
return Err(fatal!(
|
|
937
937
|
"Encountered local activity marker but the associated machine was of the \
|
|
938
938
|
wrong type! {event:?}"
|
|
939
|
-
))
|
|
939
|
+
));
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
942
|
|
|
@@ -957,9 +957,7 @@ impl WorkflowMachines {
|
|
|
957
957
|
let command = if let Some(c) = maybe_command {
|
|
958
958
|
c
|
|
959
959
|
} else {
|
|
960
|
-
return Err(
|
|
961
|
-
"No command scheduled for event {event}"
|
|
962
|
-
)));
|
|
960
|
+
return Err(nondeterminism!("No command scheduled for event {event}"));
|
|
963
961
|
};
|
|
964
962
|
|
|
965
963
|
let canceled_before_sent = self
|
|
@@ -1006,9 +1004,9 @@ impl WorkflowMachines {
|
|
|
1006
1004
|
attrs,
|
|
1007
1005
|
);
|
|
1008
1006
|
} else {
|
|
1009
|
-
return Err(
|
|
1007
|
+
return Err(fatal!(
|
|
1010
1008
|
"WorkflowExecutionStarted event did not have appropriate attributes: {event_dat}"
|
|
1011
|
-
))
|
|
1009
|
+
));
|
|
1012
1010
|
}
|
|
1013
1011
|
}
|
|
1014
1012
|
Ok(EventType::WorkflowTaskScheduled) => {
|
|
@@ -1042,9 +1040,9 @@ impl WorkflowMachines {
|
|
|
1042
1040
|
}
|
|
1043
1041
|
}
|
|
1044
1042
|
_ => {
|
|
1045
|
-
return Err(
|
|
1043
|
+
return Err(fatal!(
|
|
1046
1044
|
"The event is not a non-stateful event, but we tried to handle it as one: {event_dat}"
|
|
1047
|
-
))
|
|
1045
|
+
));
|
|
1048
1046
|
}
|
|
1049
1047
|
}
|
|
1050
1048
|
Ok(())
|
|
@@ -1080,13 +1078,12 @@ impl WorkflowMachines {
|
|
|
1080
1078
|
|
|
1081
1079
|
match message.body {
|
|
1082
1080
|
IncomingProtocolMessageBody::UpdateRequest(ur) => {
|
|
1083
|
-
let seq_id = if let SequencingId::EventId(eid) =
|
|
1084
|
-
.sequencing_id
|
|
1085
|
-
.ok_or_else(|| WFMachinesError::Fatal(SEQIDERR.to_string()))?
|
|
1081
|
+
let seq_id = if let SequencingId::EventId(eid) =
|
|
1082
|
+
message.sequencing_id.ok_or_else(|| fatal!("{SEQIDERR}"))?
|
|
1086
1083
|
{
|
|
1087
1084
|
eid
|
|
1088
1085
|
} else {
|
|
1089
|
-
return Err(
|
|
1086
|
+
return Err(fatal!("{SEQIDERR}"));
|
|
1090
1087
|
};
|
|
1091
1088
|
let um = UpdateMachine::init(
|
|
1092
1089
|
message.id,
|
|
@@ -1211,9 +1208,9 @@ impl WorkflowMachines {
|
|
|
1211
1208
|
);
|
|
1212
1209
|
}
|
|
1213
1210
|
c => {
|
|
1214
|
-
return Err(
|
|
1211
|
+
return Err(fatal!(
|
|
1215
1212
|
"A machine requested to create a new command of an unsupported type: {c:?}"
|
|
1216
|
-
))
|
|
1213
|
+
));
|
|
1217
1214
|
}
|
|
1218
1215
|
},
|
|
1219
1216
|
MachineResponse::IssueFakeLocalActivityMarker(seq) => {
|
|
@@ -1358,9 +1355,7 @@ impl WorkflowMachines {
|
|
|
1358
1355
|
let seq = attrs.seq;
|
|
1359
1356
|
let attrs: ValidScheduleLA =
|
|
1360
1357
|
ValidScheduleLA::from_schedule_la(attrs, cmd.metadata).map_err(|e| {
|
|
1361
|
-
|
|
1362
|
-
"Invalid schedule local activity request (seq {seq}): {e}"
|
|
1363
|
-
))
|
|
1358
|
+
fatal!("Invalid schedule local activity request (seq {seq}): {e}")
|
|
1364
1359
|
})?;
|
|
1365
1360
|
let (la, mach_resp) = new_local_activity(
|
|
1366
1361
|
attrs,
|
|
@@ -1468,10 +1463,7 @@ impl WorkflowMachines {
|
|
|
1468
1463
|
}
|
|
1469
1464
|
WFCommandVariant::RequestCancelExternalWorkflow(attrs) => {
|
|
1470
1465
|
let we = attrs.workflow_execution.ok_or_else(|| {
|
|
1471
|
-
|
|
1472
|
-
"Cancel external workflow command had no workflow_execution field"
|
|
1473
|
-
.to_string(),
|
|
1474
|
-
)
|
|
1466
|
+
fatal!("Cancel external workflow command had no workflow_execution field")
|
|
1475
1467
|
})?;
|
|
1476
1468
|
self.add_cmd_to_wf_task(
|
|
1477
1469
|
new_external_cancel(
|
|
@@ -1519,11 +1511,11 @@ impl WorkflowMachines {
|
|
|
1519
1511
|
let m = if let Machines::UpdateMachine(m) = self.machine_mut(m_key) {
|
|
1520
1512
|
m
|
|
1521
1513
|
} else {
|
|
1522
|
-
return Err(
|
|
1514
|
+
return Err(nondeterminism!(
|
|
1523
1515
|
"Tried to handle an update response for \
|
|
1524
1516
|
update with instance id {} but it was not found!",
|
|
1525
1517
|
&ur.protocol_instance_id
|
|
1526
|
-
))
|
|
1518
|
+
));
|
|
1527
1519
|
};
|
|
1528
1520
|
let resps = m.handle_response(ur)?;
|
|
1529
1521
|
self.process_machine_responses(m_key, resps)?;
|
|
@@ -1551,9 +1543,10 @@ impl WorkflowMachines {
|
|
|
1551
1543
|
}
|
|
1552
1544
|
|
|
1553
1545
|
fn get_machine_key(&self, id: CommandID) -> Result<MachineKey> {
|
|
1554
|
-
Ok(*self
|
|
1555
|
-
|
|
1556
|
-
|
|
1546
|
+
Ok(*self
|
|
1547
|
+
.id_to_machine
|
|
1548
|
+
.get(&id)
|
|
1549
|
+
.ok_or_else(|| nondeterminism!("Missing associated machine for {id:?}"))?)
|
|
1557
1550
|
}
|
|
1558
1551
|
|
|
1559
1552
|
fn get_machine_by_msg(&self, protocol_instance_id: &str) -> Result<MachineKey> {
|
|
@@ -1561,9 +1554,7 @@ impl WorkflowMachines {
|
|
|
1561
1554
|
.machines_by_protocol_instance_id
|
|
1562
1555
|
.get(protocol_instance_id)
|
|
1563
1556
|
.ok_or_else(|| {
|
|
1564
|
-
|
|
1565
|
-
"Missing associated machine for protocol message {protocol_instance_id}"
|
|
1566
|
-
))
|
|
1557
|
+
fatal!("Missing associated machine for protocol message {protocol_instance_id}")
|
|
1567
1558
|
})?)
|
|
1568
1559
|
}
|
|
1569
1560
|
|
|
@@ -1756,10 +1747,10 @@ fn patch_marker_handling(
|
|
|
1756
1747
|
debug!("Deprecated patch marker tried against non-patch machine, skipping.");
|
|
1757
1748
|
skip_one_or_two_events(next_event)
|
|
1758
1749
|
} else {
|
|
1759
|
-
Err(
|
|
1750
|
+
Err(nondeterminism!(
|
|
1760
1751
|
"Non-deprecated patch marker encountered for change {patch_name}, but there is \
|
|
1761
1752
|
no corresponding change command!"
|
|
1762
|
-
))
|
|
1753
|
+
))
|
|
1763
1754
|
}
|
|
1764
1755
|
}
|
|
1765
1756
|
} else if patch_machine.is_some() {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#![allow(clippy::enum_variant_names)]
|
|
2
2
|
|
|
3
|
-
use super::{
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
use super::{
|
|
4
|
+
EventInfo, StateMachine, TransitionResult, WFMachinesAdapter, WFMachinesError, fsm,
|
|
5
|
+
workflow_machines::MachineResponse,
|
|
6
|
+
};
|
|
7
|
+
use crate::worker::workflow::{fatal, machines::HistEventData, nondeterminism};
|
|
6
8
|
use std::{
|
|
7
9
|
convert::{TryFrom, TryInto},
|
|
8
10
|
time::SystemTime,
|
|
9
11
|
};
|
|
10
|
-
use
|
|
12
|
+
use temporalio_common::protos::temporal::api::{
|
|
11
13
|
enums::v1::{CommandType, EventType, WorkflowTaskFailedCause},
|
|
12
14
|
history::v1::history_event::Attributes::WorkflowTaskFailedEventAttributes,
|
|
13
15
|
};
|
|
@@ -65,10 +67,9 @@ impl WFMachinesAdapter for WorkflowTaskMachine {
|
|
|
65
67
|
let (event_id, event_type) = if let Some(ei) = event_info {
|
|
66
68
|
(ei.event_id, ei.event_type)
|
|
67
69
|
} else {
|
|
68
|
-
return Err(
|
|
70
|
+
return Err(fatal!(
|
|
69
71
|
"WF Task machine should never issue a task started trigger \
|
|
70
72
|
command in response to non-history events"
|
|
71
|
-
.to_string(),
|
|
72
73
|
));
|
|
73
74
|
};
|
|
74
75
|
|
|
@@ -100,16 +101,15 @@ impl TryFrom<HistEventData> for WorkflowTaskMachineEvents {
|
|
|
100
101
|
match time.try_into() {
|
|
101
102
|
Ok(t) => t,
|
|
102
103
|
Err(_) => {
|
|
103
|
-
return Err(
|
|
104
|
+
return Err(fatal!(
|
|
104
105
|
"Workflow task started event timestamp was inconvertible"
|
|
105
|
-
.to_string(),
|
|
106
106
|
));
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
} else {
|
|
110
|
-
return Err(
|
|
110
|
+
return Err(fatal!(
|
|
111
111
|
"Workflow task started event must contain timestamp: {e}"
|
|
112
|
-
))
|
|
112
|
+
));
|
|
113
113
|
};
|
|
114
114
|
WFTStartedDat {
|
|
115
115
|
started_event_id: e.event_id,
|
|
@@ -135,15 +135,13 @@ impl TryFrom<HistEventData> for WorkflowTaskMachineEvents {
|
|
|
135
135
|
},
|
|
136
136
|
})
|
|
137
137
|
} else {
|
|
138
|
-
return Err(
|
|
139
|
-
"Workflow task failed is missing attributes: {e}"
|
|
140
|
-
)));
|
|
138
|
+
return Err(fatal!("Workflow task failed is missing attributes: {e}"));
|
|
141
139
|
}
|
|
142
140
|
}
|
|
143
141
|
_ => {
|
|
144
|
-
return Err(
|
|
142
|
+
return Err(nondeterminism!(
|
|
145
143
|
"Event does not apply to a wf task machine: {e}"
|
|
146
|
-
))
|
|
144
|
+
));
|
|
147
145
|
}
|
|
148
146
|
})
|
|
149
147
|
}
|
|
@@ -28,22 +28,25 @@ use std::{
|
|
|
28
28
|
sync::{Arc, mpsc::Sender},
|
|
29
29
|
time::{Duration, Instant},
|
|
30
30
|
};
|
|
31
|
-
use
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
use temporalio_common::{
|
|
32
|
+
errors::WorkflowErrorType,
|
|
33
|
+
protos::{
|
|
34
|
+
TaskToken,
|
|
35
|
+
coresdk::{
|
|
36
|
+
workflow_activation::{
|
|
37
|
+
WorkflowActivation, create_evict_activation, query_to_job,
|
|
38
|
+
remove_from_cache::EvictionReason, workflow_activation_job,
|
|
39
|
+
},
|
|
40
|
+
workflow_commands::{FailWorkflowExecution, QueryResult},
|
|
41
|
+
workflow_completion,
|
|
42
|
+
},
|
|
43
|
+
temporal::api::{
|
|
44
|
+
command::v1::command::Attributes as CmdAttribs,
|
|
45
|
+
enums::v1::{VersioningBehavior, WorkflowTaskFailedCause},
|
|
46
|
+
failure::v1::Failure,
|
|
38
47
|
},
|
|
39
|
-
workflow_commands::{FailWorkflowExecution, QueryResult},
|
|
40
|
-
workflow_completion,
|
|
41
|
-
},
|
|
42
|
-
temporal::api::{
|
|
43
|
-
command::v1::command::Attributes as CmdAttribs,
|
|
44
|
-
enums::v1::{VersioningBehavior, WorkflowTaskFailedCause},
|
|
45
|
-
failure::v1::Failure,
|
|
46
48
|
},
|
|
49
|
+
worker::WorkerConfig,
|
|
47
50
|
};
|
|
48
51
|
use tokio::sync::oneshot;
|
|
49
52
|
use tracing::Span;
|
|
@@ -70,7 +73,9 @@ pub(super) struct ManagedRun {
|
|
|
70
73
|
/// pushing things out and then directly back in. The downside is this is the only "impure" part
|
|
71
74
|
/// of the in/out nature of workflow state management. If there's ever a sensible way to lift it
|
|
72
75
|
/// up, that'd be nice.
|
|
73
|
-
|
|
76
|
+
///
|
|
77
|
+
/// This field is `None` when `WorkerTaskTypes.enable_local_activities` is false.
|
|
78
|
+
local_activity_request_sink: Option<Rc<dyn LocalActivityRequestSink>>,
|
|
74
79
|
/// Set if the run is currently waiting on the execution of some local activities.
|
|
75
80
|
waiting_on_la: Option<WaitingOnLAs>,
|
|
76
81
|
/// Is set to true if the machines encounter an error and the only subsequent thing we should
|
|
@@ -105,7 +110,7 @@ impl ManagedRun {
|
|
|
105
110
|
pub(super) fn new(
|
|
106
111
|
basics: RunBasics,
|
|
107
112
|
wft: PermittedWFT,
|
|
108
|
-
local_activity_request_sink: Rc<dyn LocalActivityRequestSink
|
|
113
|
+
local_activity_request_sink: Option<Rc<dyn LocalActivityRequestSink>>,
|
|
109
114
|
) -> (Self, RunUpdateAct) {
|
|
110
115
|
let metrics = basics.metrics.clone();
|
|
111
116
|
let config = basics.worker_config.clone();
|
|
@@ -240,10 +245,10 @@ impl ManagedRun {
|
|
|
240
245
|
let r = self.wfm.get_next_activation()?;
|
|
241
246
|
if r.jobs.is_empty() {
|
|
242
247
|
return Err(RunUpdateErr {
|
|
243
|
-
source:
|
|
248
|
+
source: crate::worker::workflow::fatal!(
|
|
244
249
|
"Machines created for {} with no jobs",
|
|
245
250
|
self.wfm.machines.run_id
|
|
246
|
-
)
|
|
251
|
+
),
|
|
247
252
|
complete_resp_chan: None,
|
|
248
253
|
});
|
|
249
254
|
}
|
|
@@ -261,7 +266,7 @@ impl ManagedRun {
|
|
|
261
266
|
lawait.hb_timeout_handle.abort();
|
|
262
267
|
lawait.hb_timeout_handle = sink_heartbeat_timeout_start(
|
|
263
268
|
self.wfm.machines.run_id.clone(),
|
|
264
|
-
self.local_activity_request_sink.
|
|
269
|
+
self.local_activity_request_sink.as_deref(),
|
|
265
270
|
start_time,
|
|
266
271
|
lawait.wft_timeout,
|
|
267
272
|
);
|
|
@@ -307,9 +312,13 @@ impl ManagedRun {
|
|
|
307
312
|
self.wfm.machines.reset_last_started_id(id);
|
|
308
313
|
}
|
|
309
314
|
// Tell the LA manager that we're done with the WFT
|
|
310
|
-
self.local_activity_request_sink
|
|
311
|
-
|
|
312
|
-
|
|
315
|
+
if let Some(ref local_act_request_sink) = self.local_activity_request_sink {
|
|
316
|
+
local_act_request_sink.sink_reqs(vec![
|
|
317
|
+
LocalActRequest::IndicateWorkflowTaskCompleted(
|
|
318
|
+
self.wfm.machines.run_id.clone(),
|
|
319
|
+
),
|
|
320
|
+
]);
|
|
321
|
+
}
|
|
313
322
|
}
|
|
314
323
|
|
|
315
324
|
retme
|
|
@@ -402,7 +411,7 @@ impl ManagedRun {
|
|
|
402
411
|
}) {
|
|
403
412
|
ActivationCompleteOutcome::ReportWFTFail(FailedActivationWFTReport::Report(
|
|
404
413
|
tt,
|
|
405
|
-
WorkflowTaskFailedCause::
|
|
414
|
+
WorkflowTaskFailedCause::WorkflowWorkerUnhandledFailure,
|
|
406
415
|
Failure::application_failure(reason, true).into(),
|
|
407
416
|
))
|
|
408
417
|
} else {
|
|
@@ -759,7 +768,7 @@ impl ManagedRun {
|
|
|
759
768
|
completion_dat: Some((data, completion.resp_chan)),
|
|
760
769
|
hb_timeout_handle: sink_heartbeat_timeout_start(
|
|
761
770
|
self.run_id().to_string(),
|
|
762
|
-
self.local_activity_request_sink.
|
|
771
|
+
self.local_activity_request_sink.as_deref(),
|
|
763
772
|
start_t,
|
|
764
773
|
wft_timeout,
|
|
765
774
|
),
|
|
@@ -885,7 +894,7 @@ impl ManagedRun {
|
|
|
885
894
|
// We just checked it is some, unwrap OK.
|
|
886
895
|
let c = self.completion_waiting_on_page_fetch.take().unwrap();
|
|
887
896
|
let run_upd = self.failed_completion(
|
|
888
|
-
WorkflowTaskFailedCause::
|
|
897
|
+
WorkflowTaskFailedCause::WorkflowWorkerUnhandledFailure,
|
|
889
898
|
info.reason,
|
|
890
899
|
Failure::application_failure(info.message, false).into(),
|
|
891
900
|
true,
|
|
@@ -1019,7 +1028,7 @@ impl ManagedRun {
|
|
|
1019
1028
|
let fail_cause = if matches!(&fail.source, WFMachinesError::Nondeterminism(_)) {
|
|
1020
1029
|
WorkflowTaskFailedCause::NonDeterministicError
|
|
1021
1030
|
} else {
|
|
1022
|
-
WorkflowTaskFailedCause::
|
|
1031
|
+
WorkflowTaskFailedCause::WorkflowWorkerUnhandledFailure
|
|
1023
1032
|
};
|
|
1024
1033
|
self.failed_completion(
|
|
1025
1034
|
fail_cause,
|
|
@@ -1139,6 +1148,7 @@ impl ManagedRun {
|
|
|
1139
1148
|
}
|
|
1140
1149
|
}
|
|
1141
1150
|
|
|
1151
|
+
let attempt = self.wft.as_ref().map(|t| t.info.attempt).unwrap_or(1);
|
|
1142
1152
|
ActivationCompleteOutcome::ReportWFTSuccess(ServerCommandsWithWorkflowInfo {
|
|
1143
1153
|
task_token: data.task_token,
|
|
1144
1154
|
action: ActivationAction::WftComplete {
|
|
@@ -1148,6 +1158,7 @@ impl ManagedRun {
|
|
|
1148
1158
|
query_responses,
|
|
1149
1159
|
sdk_metadata: machines_wft_response.metadata_for_complete(),
|
|
1150
1160
|
versioning_behavior: data.versioning_behavior,
|
|
1161
|
+
attempt,
|
|
1151
1162
|
},
|
|
1152
1163
|
})
|
|
1153
1164
|
} else {
|
|
@@ -1168,7 +1179,12 @@ impl ManagedRun {
|
|
|
1168
1179
|
&mut self,
|
|
1169
1180
|
new_local_acts: Vec<LocalActRequest>,
|
|
1170
1181
|
) -> Result<(), WFMachinesError> {
|
|
1171
|
-
let immediate_resolutions =
|
|
1182
|
+
let immediate_resolutions =
|
|
1183
|
+
if let Some(ref local_act_request_sink) = self.local_activity_request_sink {
|
|
1184
|
+
local_act_request_sink.sink_reqs(new_local_acts)
|
|
1185
|
+
} else {
|
|
1186
|
+
Vec::new()
|
|
1187
|
+
};
|
|
1172
1188
|
for resolution in immediate_resolutions {
|
|
1173
1189
|
self.wfm
|
|
1174
1190
|
.notify_of_local_result(LocalResolution::LocalActivity(resolution))?;
|
|
@@ -1306,21 +1322,23 @@ fn put_queries_in_act(act: &mut WorkflowActivation, wft: &mut OutstandingTask) {
|
|
|
1306
1322
|
}
|
|
1307
1323
|
fn sink_heartbeat_timeout_start(
|
|
1308
1324
|
run_id: String,
|
|
1309
|
-
sink:
|
|
1325
|
+
sink: Option<&dyn LocalActivityRequestSink>,
|
|
1310
1326
|
wft_start_time: Instant,
|
|
1311
1327
|
wft_timeout: Duration,
|
|
1312
1328
|
) -> AbortHandle {
|
|
1313
1329
|
// The heartbeat deadline is 80% of the WFT timeout
|
|
1314
1330
|
let deadline = wft_start_time.add(wft_timeout.mul_f32(WFT_HEARTBEAT_TIMEOUT_FRACTION));
|
|
1315
1331
|
let (abort_handle, abort_reg) = AbortHandle::new_pair();
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1332
|
+
if let Some(la_sink) = sink {
|
|
1333
|
+
la_sink.sink_reqs(vec![LocalActRequest::StartHeartbeatTimeout {
|
|
1334
|
+
send_on_elapse: HeartbeatTimeoutMsg {
|
|
1335
|
+
run_id,
|
|
1336
|
+
span: Span::current(),
|
|
1337
|
+
},
|
|
1338
|
+
deadline,
|
|
1339
|
+
abort_reg,
|
|
1340
|
+
}]);
|
|
1341
|
+
}
|
|
1324
1342
|
abort_handle
|
|
1325
1343
|
}
|
|
1326
1344
|
|
|
@@ -1606,7 +1624,7 @@ mod tests {
|
|
|
1606
1624
|
}
|
|
1607
1625
|
|
|
1608
1626
|
mod command_utils {
|
|
1609
|
-
use
|
|
1627
|
+
use temporalio_common::protos::coresdk::workflow_commands::{
|
|
1610
1628
|
CancelWorkflowExecution, CompleteWorkflowExecution, QueryResult, UpdateResponse,
|
|
1611
1629
|
};
|
|
1612
1630
|
|