solid_errors icon indicating copy to clipboard operation
solid_errors copied to clipboard

Add one_email_per_occurrence option and migration task

Open imageaid opened this issue 7 months ago • 13 comments

Motivation:

We are happily using Solid Errors in our production app but because that app connects to some external APIs we can run into situations where we are sent a lot of emails for the same error's reoccurrence.

Details:

Introduced a new configuration option one_email_per_occurrence that serves to limit email notifications to one per occurrence. If an error is resolved but reoccurs, an email will be sent, again, for that first reoccurrence.

In order to do this, a migration was created to add a new column/attribute to the solid_errors table called prev_resolved_at.

This column/attribute is updated to match the resolved_at value whenever it is set - but it is never nill'ed out like resolved_at is when the issue is resolved.

A Rake task, solid_errors:install_migrations, was also added to copy any new migrations from the lib/solid_errors/db/migrate directory and then immediately run them.

The README was updated as was the error controller to support the new feature.

The .gemspec was also updated to add a note reminding users to ensure they've run the task to copy over the migration(s).

Please let me know if there's anything you'd change, do better, etc. Thank you for your excellent work on Solid Errors. We are grateful to have it!

imageaid avatar Jul 17 '24 18:07 imageaid