v2.14
VRY Fix Summary - v2.14 (This is a build-up to v2.2 which will be released soon.)
Issue
The crash RuntimeError: Event loop stopped before Future completed occurred because:
- The websocket's
while Trueloop had no way to gracefully exit - When the app closed,
stop()killed the event loop while websocket was still waiting - Race condition between server shutdown and websocket operations
Solution
websocket.py changes:
- Added
_shutdownflag andrequest_shutdown()method - Changed
await websocket.recv()to useasyncio.wait_for()with 2-second timeout - Now checks shutdown flag periodically instead of blocking indefinitely
- Proper handling of
asyncio.CancelledErrorandConnectionClosed
main.py changes:
- Added
threading.Event(_shutdown_event) for coordinated shutdown stop()now callsWss.request_shutdown()before closing event loop- Added
_cleanup_loop()method that properly cancels pending tasks - Better exception handling for
RuntimeErrorin_wait_for_state_change()
Performance Optimizations
1. Pregame-to-Ingame Data Reuse
- When transitioning from agent select to in-game, teammate data (ranks, stats) is cached
- Reduces API calls by ~50% for allies when match starts
- Cache cleared when returning to menus
2. LRU Cache for Player Data
- Added
LRUCacheclass with TTL support - Caches player rank/stats data for 60 seconds
- Prevents redundant API calls for same player
3. Lazy Session Creation (Loadouts.py)
- aiohttp session created on-demand, not at init
- API responses (weapons, agents, sprays, titles) cached after first fetch
- Proper session cleanup in
close()method
4. Team Ordering Fix
- Maintains original API order within each team group
Resource Optimization
Reduced Memory
- Removed redundant data copies
- Use
set()instead of list forseentracking - Simplified theme handling
Faster Startup
- Static API data cached after first load
- Buddy data preloaded asynchronously
TL;DR :
. The app now handles:
- Clean exit without crashes
- Faster subsequent matches (cached data)
- Better resource cleanup