FargoRate Sync Architecture & Cloud Run Tasks
Maintaining up-to-date player ratings is critical for competitive fairness in handicapped pool leagues. Here is how LeagueMaster automates FargoRate synchronization using .NET 10, Google Cloud Run, and Cloud Scheduler.
The Challenge
Section titled “The Challenge”In a typical multi-division league with hundreds of players:
- Players frequently compete in regional tournaments and weekend events, shifting their ratings mid-season.
- Manually querying each player’s rating before league night is tedious and error-prone for operators.
- Public rating APIs enforce strict rate limits and require resilient retry policies.
Architectural Overview
Section titled “Architectural Overview”sequenceDiagram participant CS as Google Cloud Scheduler participant CR as LeagueMaster.Tasks (.NET 10) participant FA as FargoRate Public API participant FS as Google Cloud Firestore participant DC as Discord DevOps Webhook
CS->>CR: Trigger /api/fargo/sync (Nightly 3 AM CT) CR->>FS: Query active players with linked Fargo IDs loop For each player batch CR->>FA: GET /api/fargo/rating/{fargoId} (with exponential backoff) FA-->>CR: Return Rating, Robustness, LastUpdated CR->>FS: Batch update user profile & FairMatch cache end CR->>DC: Post Discord audit summary (Updated N players)Resilience & Rate Limiting
Section titled “Resilience & Rate Limiting”Our C# FargoApiClient employs Polly resilience pipelines:
- Exponential Backoff with Jitter: Gracefully handles transient 429 and 503 HTTP responses.
- Batch Processing: Processes players in parallel batches of 10 with sliding window throttles.
- Circuit Breaker: Halts execution and alerts the DevOps Discord channel if upstream API availability falls below 90%.
