Skip to content

v2.14

Choose a tag to compare

@Privex-chat Privex-chat released this 09 Dec 09:35
· 9 commits to main since this release
e368064

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:

  1. The websocket's while True loop had no way to gracefully exit
  2. When the app closed, stop() killed the event loop while websocket was still waiting
  3. Race condition between server shutdown and websocket operations

Solution

websocket.py changes:

  • Added _shutdown flag and request_shutdown() method
  • Changed await websocket.recv() to use asyncio.wait_for() with 2-second timeout
  • Now checks shutdown flag periodically instead of blocking indefinitely
  • Proper handling of asyncio.CancelledError and ConnectionClosed

main.py changes:

  • Added threading.Event (_shutdown_event) for coordinated shutdown
  • stop() now calls Wss.request_shutdown() before closing event loop
  • Added _cleanup_loop() method that properly cancels pending tasks
  • Better exception handling for RuntimeError in _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 LRUCache class 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 for seen tracking
  • 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