"Refactor error handling and rate limiting in FEHLER_BEHOBEN module"
This commit is contained in:
@@ -265,11 +265,19 @@ class Printer(Base):
|
||||
|
||||
### Rate-Limiting
|
||||
```python
|
||||
# Rate-Limits für API-Endpunkte
|
||||
@limit_requests("printer_monitor_live", 60, 5) # 5/min für Live-Status
|
||||
@limit_requests("printer_monitor_summary", 30, 10) # 10/30s für Summary
|
||||
@limit_requests("printer_monitor_cache", 120, 3) # 3/2min für Cache-Clear
|
||||
@limit_requests("printer_monitor_init", 300, 2) # 2/5min für Initialisierung
|
||||
# Rate-Limits für API-Endpunkte (bereits in RATE_LIMITS konfiguriert)
|
||||
@limit_requests("printer_monitor_live") # 5 Anfragen pro Minute
|
||||
@limit_requests("printer_monitor_summary") # 10 Anfragen pro 30 Sekunden
|
||||
@limit_requests("printer_monitor_cache") # 3 Anfragen pro 2 Minuten
|
||||
@limit_requests("printer_monitor_init") # 2 Anfragen pro 5 Minuten
|
||||
|
||||
# Konfiguration in utils/rate_limiter.py:
|
||||
RATE_LIMITS = {
|
||||
'printer_monitor_live': RateLimit(5, 60, "Zu viele Live-Status-Anfragen..."),
|
||||
'printer_monitor_summary': RateLimit(10, 30, "Zu viele Zusammenfassungs-Anfragen..."),
|
||||
'printer_monitor_cache': RateLimit(3, 120, "Zu viele Cache-Lösch-Anfragen..."),
|
||||
'printer_monitor_init': RateLimit(2, 300, "Zu viele Initialisierungs-Anfragen..."),
|
||||
}
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
Reference in New Issue
Block a user