fix(router): type per-key spend totals without loop Final bindings

This commit is contained in:
Emerson Gomes 2026-09-15 13:04:45 -05:00
parent 6cb7a6f600
commit 16e5642c25
No known key found for this signature in database
GPG key ID: D3DF28AB5D1B5E17

View file

@ -677,12 +677,12 @@ class RouterBudgetLimiting(CustomLogger):
for key, value in redis_values.items():
if value is None:
continue
pending_spend: Final = sum(
pending_spend = sum( # rebind-ok: each cache key has independent queued spend
operation["increment_value"]
for operation in self.redis_increment_operation_queue
if operation["key"] == key
)
updated_spend: Final = float(value) + pending_spend
updated_spend = float(value) + pending_spend # rebind-ok: each cache key has an independent total
await self.dual_cache.in_memory_cache.async_set_cache(key=key, value=updated_spend)
verbose_router_logger.debug("Updated in-memory cache for %s: %s", key, updated_spend)