PrefectHQ
prefect
BlogDocsChangelog

Fix active_slots display for rate limits with slot decay

#20201
Comparing
fix-rate-limit-slots-ui-display
(
e488e61
) with
main
(
fa92f01
)
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
0%
602.6 µs602.5 µs

Ignored

bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-23%
10.5 ms13.6 ms
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.5 ms107.7 ms
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+2%
33.2 ms32.6 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
5.6 ms5.7 ms
bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+2%
169.3 ms166.5 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s

Commits

Click on a commit to change the comparison range
Base
main
fa92f01
-0.32%
Fix active_slots display for rate limits with slot decay Issue: The active_slots counter for global concurrency limits with slot_decay_per_second configured was not updating in the UI/API, appearing stuck at the maximum value even though rate limiting was functioning correctly. Root Cause: The read_concurrency_limit() and read_all_concurrency_limits() functions were returning the raw active_slots database column instead of computing the value with decay applied. While slot acquisition correctly used active_slots_after_decay() to check availability, the API responses did not reflect this computation. Solution: Modified both read functions to: 1. Select the computed active_slots_after_decay() and denied_slots_after_decay() values alongside the model 2. Override the model's active_slots and denied_slots attributes with the computed values before returning This ensures the API/UI displays accurate real-time slot availability that accounts for time-based decay, matching the behavior used during slot acquisition. Fixes #20187 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
68ffc09
19 hours ago
by zhen0
+0.37%
Add populate_existing to force fresh fetch from database Fixes session identity map issues where cached ORM objects weren't being refreshed with computed decay values
e488e61
2 hours ago
by zhen0
© 2026 CodSpeed Technology
Home Terms Privacy Docs