themarshallproject / klaxon

Klaxon enables reporters and editors to monitor scores of sites on the web for newsworthy changes.
https://newsklaxon.org
MIT License
644 stars 200 forks source link

Timeouts when deleting a page with lots of snapshots #699

Open Kat-Alo opened 12 months ago

Kat-Alo commented 12 months ago

For a trial of Klaxon, we added a page that would change often enough to trigger an alert for every page check. Now, we want to delete the page, but because it has so many snapshots, the deletion operation is timing out.

I believe this is a result of the slow cascading deletions noted in this blog post. It seems the authors have created a gem that nullifies the relationship between parent and child records (in this case page and page snapshots) and then destroys the child records asynchronously.

Given that the model relationships for Klaxon aren't too complicated, I'm wondering if another viable solution would be to delete instead of destroy the records. I'm not very Rails-savvy, so maybe that's a poor option.

Planning to give this gem a go and will open a PR if it works out for us.