PrefectHQ
prefect
BlogDocsChangelog

fix: cancel orphaned flow runs when deployment is deleted during concurrency wait

#19829Closed
Comparing
fix/cancel-orphaned-runs-with-deleted-deployments
(
08bca0b
) with
main
(
370afe4
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s
bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
-1%
463 µs466.1 µs

Ignored

bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+5%
33.7 ms32.2 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+12%
5.6 ms5 ms
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-13%
11.4 ms13.1 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.7 ms107.4 ms
bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+1%
169.1 ms167 ms

Commits

Click on a commit to change the comparison range
Base
main
370afe4
-0.35%
fix: cancel orphaned flow runs when deployment is deleted during concurrency wait When a flow run is waiting in AwaitingConcurrencySlot state and its deployment is deleted, the worker would previously keep polling the run indefinitely. The server's SecureFlowConcurrencySlots rule returns an ABORT when the deployment doesn't exist, but the worker only logged this and returned False, leaving the run stuck. This fix cancels the run when we receive a "Deployment not found" abort, preventing the infinite polling loop and giving users visibility that the run was terminated due to deployment deletion. Also adds regression tests for: - Server correctly updating next_scheduled_start_time on concurrency rejection - Worker cancelling runs on deployment-not-found abort - Worker NOT cancelling runs for other abort reasons (like concurrency limit=0) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
08bca0b
15 hours ago
by zzstoatzz
© 2025 CodSpeed Technology
Home Terms Privacy Docs