Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On dev and prod, deleting pages with lots of snapshots results in a 504 timeout error. My suspicion is that it's because the Rails deletion of records with children is a very costly operation.
Luckily, folks at an org called Census had a very similar problem and created a little tool they call Miss Hannigan. The tool nullifies the relationship between the children snapshots and the parent page and purges the orphaned children records ansynchronously.
If we are concerned about relying on this particular (seemingly little-known) gem, we could port some of the logic into Klaxon — not sure what that protocol looks like.
To test
docker-compose down && docker-compose build && docker-compose up
http://localhost:3001/klaxon/
(you won't receive a sign-in email since you're running things locally. Look for the HTML of the body of the email in your terminal to find the link w the sign-in token)klaxon-psql
\c klaxon;
select page_id from page_snapshots;
(to confirm a snapshot has been generated for a page)The real test will be getting these changes to dev and confirming we can delete the big record that's been causing a timeout. Then, we'll be able to open a PR with the original Klaxon.