Refactor calendar sync to prioritize oldest synced employees with human-readable timestamps

This commit is contained in:
root
2025-10-26 08:58:48 +00:00
parent b18e770f12
commit 96eabe3db6
4 changed files with 59 additions and 26 deletions

View File

@@ -33,9 +33,9 @@ FETCH_TO = f"{current_year + 9}-12-31T23:59:59" # End of 9 years ahead
# Constants: Für 600/min -> 600 Tokens, Refill 600/60=10 pro Sekunde -> 10/1000 pro ms
RATE_LIMIT_KEY = 'google_calendar_api_tokens'
MAX_TOKENS = 5
REFILL_RATE_PER_MS = 2 / 1000 # Float nur hier; Ops mit Integers
MIN_WAIT = 0.2 # 200ms
MAX_TOKENS = 7
REFILL_RATE_PER_MS = 7 / 1000 # Float nur hier; Ops mit Integers
MIN_WAIT = 0.1 # 100ms
JITTER_MAX = 0.1 # Optional: Zufalls-Delay 0-100ms für Glättung
async def enforce_global_rate_limit(context=None):