stream: compteur d'audit des lignes tenu même avec un charger enregistré
1 changed file +6 −2
modified
hfmarketdata/api/stream/accounting.py
+6 −2
@@ -32,9 +32,13 @@ def get_charger() -> Charger | None: | ||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | def charge(principal: str, rows: int = REDUCED_RATE_ROWS_PER_MESSAGE) -> None: |
| 35 | + """Charge `rows` to the principal: through the registered charger (rate-limit quota) when present, | |
| 36 | + and always in the per-day audit counter `stream:rows:{principal}:{day}` (24 h TTL).""" | |
| 35 | 37 | if _charger is not None: |
| 36 | − _charger(principal, rows) | |
| 37 | − return | |
| 38 | + try: | |
| 39 | + _charger(principal, rows) | |
| 40 | + except Exception: | |
| 41 | + pass | |
| 38 | 42 | try: |
| 39 | 43 | from .broker import get_redis |
| 40 | 44 | r = get_redis() |
| 41 | 45 | |