Deleting large Accounts/Inboxes with object.destroy! can time out and create heavy destroy_async fan-out; this change adds a simple pre-purge that batch-destroys heavy associations first . ``` Account: conversations, contacts Inbox: conversations, contact_inboxes ``` We use find_in_batches(5000), then proceeds with destroy!, reducing DB pressure and race conditions while preserving callbacks and leaving the behavior for non heavy models unchanged. The change is also done in a way to easily add additional objects or relations to the list. fixes: https://linear.app/chatwoot/issue/CW-3106/inbox-deletion-process-update-the-flow |
||
|---|---|---|
| .. | ||
| account | ||
| agent_bots | ||
| agents | ||
| avatar | ||
| campaigns | ||
| channels | ||
| conversations | ||
| crm | ||
| inboxes | ||
| internal | ||
| labels | ||
| migration | ||
| notification | ||
| webhooks | ||
| bulk_actions_job_spec.rb | ||
| data_import_job_spec.rb | ||
| delete_object_job_spec.rb | ||
| event_dispatcher_job_spec.rb | ||
| hook_job_spec.rb | ||
| mutex_application_job_spec.rb | ||
| send_on_slack_job_spec.rb | ||
| send_reply_job_spec.rb | ||
| slack_unfurl_job_spec.rb | ||
| trigger_scheduled_items_job_spec.rb | ||
| webhook_job_spec.rb | ||