Replace the minimal sync-only shutdown (which only saved autonomous state) with a comprehensive async graceful_shutdown() coroutine that: 1. Ends active voice sessions (disconnect, release GPU locks, cleanup audio) 2. Saves autonomous engine state 3. Stops the APScheduler 4. Cancels all tracked background tasks (from task_tracker) 5. Closes the Discord gateway connection Signal handlers (SIGTERM/SIGINT) now schedule the async shutdown on the running event loop. The atexit handler is kept as a last-resort sync fallback. Resolves #5, also addresses #4 (voice cleanup at shutdown)
46 KiB
46 KiB