🔧 Critical Fix: Global Rate Limiting
This release fixes a critical issue where multiple simultaneous API calls were being made even when HTTP 429 (rate limiting) errors occurred, preventing the system from ever recovering.
🐛 Problem Fixed
- Multiple Simultaneous API Calls: The system was making API calls from multiple sources simultaneously during 429 errors
- No Global Coordination: Each API call was handled independently without global coordination
- Race Conditions: 429 error handling was per-instance rather than global
- Never-Ending 429 Loop: System kept making calls even when rate limited, preventing recovery
✅ Solution Implemented
🌐 Global Rate Limiting System
- Global 429 State Management: Added class-level variables to track 429 errors across all API manager instances
- Global Lock Mechanism: Prevents race conditions between multiple API calls
- Global Pause System: When any API call gets a 429 error, ALL API calls pause globally
⏱️ Progressive Pause Times
- 2 minutes → 4 minutes → 8 minutes → 16 minutes → 30 minutes max
- Prevents rapid re-triggering of 429 errors
- Allows API to fully recover before resuming calls
🚫 Eliminated Direct API Calls
- Removed direct
device.async_get_features()call during setup - All API calls now go through the coordinated API manager system
- Prevents conflicts between setup and coordinator calls
🔄 Coordinated Error Handling
- When any API call gets a 429 error, it updates the global state
- All subsequent API calls (from any coordinator) respect the global pause
- Successful calls reset the global 429 state
📊 Expected Results
- ✅ No more simultaneous API calls during 429 errors
- ✅ Proper rate limit respect - system pauses all calls when rate limited
- ✅ Faster recovery - progressive backoff prevents rapid re-triggering
- ✅ Stable operation - system allows API to recover before resuming
- ✅ Eliminated 429 loops - no more never-ending rate limiting cycles
🔧 Technical Changes
- api_manager.py: Added global 429 state management and coordination
- init.py: Removed direct API calls during device initialization
- Global Lock: Ensures thread-safe global state management
- Progressive Backoff: Intelligent pause times based on consecutive 429 errors
🚀 Migration
No configuration changes required. The fix is automatically active after updating.
This release should completely resolve the issue where users experienced continuous 429 errors due to multiple simultaneous API calls, providing a much more stable and respectful integration experience.