Avatar for the PrefectHQ user
PrefectHQ
prefect
BlogDocsChangelog

Migrate flow_runs functions from sync_compatible to async_dispatch

#18416
Comparing
migrate-flow-runs-async-dispatch
(
5e109a6
) with
main
(
0efc8d5
)
CodSpeed Performance Gauge
0%
Improvements
0
Regressions
0
Untouched
2
New
0
Dropped
0
Ignored
6

Benchmarks

Passed

bench_import_prefect_flow
benches/bench_import.py::bench_import_prefect_flow
CodSpeed Performance Gauge
0%
1.3 s
1.3 s
bench_task_decorator
benches/bench_tasks.py::bench_task_decorator
CodSpeed Performance Gauge
0%
456.9 µs
458.7 µs

Ignored

bench_flow_call[options0]Ignored
benches/bench_flows.py::bench_flow_call[options0]
CodSpeed Performance Gauge
-2%
165 ms
168.6 ms
bench_flow_call[options1]Ignored
benches/bench_flows.py::bench_flow_call[options1]
CodSpeed Performance Gauge
0%
105.9 ms
106 ms
bench_flow_decoratorIgnored
benches/bench_flows.py::bench_flow_decorator
CodSpeed Performance Gauge
+13%
4.8 ms
4.2 ms
bench_import_prefectIgnored
benches/bench_import.py::bench_import_prefect
CodSpeed Performance Gauge
0%
2.7 ms
2.7 ms
bench_task_callIgnored
benches/bench_tasks.py::bench_task_call
CodSpeed Performance Gauge
-3%
167 ms
172 ms
bench_task_submitIgnored
benches/bench_tasks.py::bench_task_submit
CodSpeed Performance Gauge
-41%
4.4 ms
7.5 ms

Commits

Click on a commit to change the comparison range
Base
main
0efc8d5
0%
Migrate flow_runs functions from sync_compatible to async_dispatch This PR migrates pause_flow_run, suspend_flow_run, and resume_flow_run from the sync_compatible decorator to the async_dispatch pattern. Since these functions involve complex async operations (event subscriptions, waiting, polling), the sync versions are implemented as thin wrappers using run_coro_as_sync rather than full reimplementations. Changes: - Renamed async functions with 'a' prefix (apause_flow_run, etc.) - Created sync versions that use run_coro_as_sync to call async versions - Added async_dispatch decorator to connect sync/async implementations - Added tests to verify correct dispatch behavior 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
07ec8f5
2 days ago
by zzstoatzz
0%
Fix suspend_flow_run async dispatch by removing @inject_client from sync version The @inject_client decorator always returns an async function, which was interfering with the async_dispatch pattern. The client injection should only be on the async version (asuspend_flow_run) to maintain proper dispatch behavior in sync contexts. This fixes the failing test_flow_is_suspended[sync] test where suspend_flow_run was incorrectly returning a coroutine in sync flows. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5e109a6
2 days ago
by zzstoatzz
© 2025 CodSpeed Technology
Home Terms Privacy Docs