mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-02-23 12:53:41 +00:00
When a user is deleted from the panel, the subscription may already be cascade-deleted by the time the webhook handler tries to decrement server counters. This caused StaleDataError followed by PendingRollbackError when accessing subscription.id in the error handler. - Save subscription.id before DB operations to avoid lazy load after rollback - Catch StaleDataError explicitly and rollback the session - Re-fetch subscription/user after potential rollback in _handle_user_deleted - Skip subscription cleanup if it was already cascade-deleted