fix: invalidate inbox cache key immediately on delete

This commit is contained in:
Shivam Mishra
2026-02-13 16:12:26 +05:30
parent 2c2f0547f7
commit 37da4dd8ca
@@ -66,7 +66,12 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
end
def destroy
::DeleteObjectJob.perform_later(@inbox, Current.user, request.ip) if @inbox.present?
if @inbox.present?
# Invalidate cache immediately so frontends don't serve stale data
# while the async DeleteObjectJob is still in the queue.
Current.account.update_cache_key('inbox')
::DeleteObjectJob.perform_later(@inbox, Current.user, request.ip)
end
render status: :ok, json: { message: I18n.t('messages.inbox_deletetion_response') }
end