(self, now: float)
| 210 | self._pending: dict[str, tuple[float, float]] = {} |
| 211 | |
| 212 | def _gc(self, now: float) -> float: |
| 213 | live: dict[str, tuple[float, float]] = {} |
| 214 | total = 0.0 |
| 215 | for rid, (amount, ts) in self._pending.items(): |
| 216 | if now - ts <= self._MAX_AGE_S: |
| 217 | live[rid] = (amount, ts) |
| 218 | total += amount |
| 219 | self._pending = live |
| 220 | return total |
| 221 | |
| 222 | async def reserve(self, reservation_id: str, estimated_cost: float): |
| 223 | async with self._lock: |
no outgoing calls
no test coverage detected