docbrown/app
Jamie Gaskins 820dd9b5a6
Allow Emails::RemoveOldEmailsWorker to run longer (#15085)
* Allow Emails::RemoveOldEmailsWorker to run longer

We set the SQL statement timeout based on the STATEMENT_TIMEOUT
environment variable (defaulting to 2.5 seconds in production), but not
all SQL queries are created equal. Since some may take longer out of
necessity, this PR introduces a `Model.with_statement_timeout` method
that allows you to change the SQL statement timeout only for a given
block.

* EmailMessage doesn't inherit ApplicationRecord

It inherits from `Ahoy::Message`, which inherits directly from
`ActiveRecord::Base`.

[3] pry(main)> EmailMessage.ancestors
=> [EmailMessage(id: integer, clicked_at: datetime, content: text, feedback_message_id: integer, mailer: string, sent_at: datetime, subject: text, to: text, token: string, user_id: integer, user_type: string, utm_campaign: string, utm_content: string, utm_medium: string, utm_source: string, utm_term: string),
 EmailMessage::GeneratedAssociationMethods,
 EmailMessage::GeneratedAttributeMethods,
 Ahoy::Message(id: integer, clicked_at: datetime, content: text, feedback_message_id: integer, mailer: string, sent_at: datetime, subject: text, to: text, token: string, user_id: integer, user_type: string, utm_campaign: string, utm_content: string, utm_medium: string, utm_source: string, utm_term: string),
 Kaminari::ConfigurationMethods,
 Kaminari::ActiveRecordModelExtension,
 Ahoy::Message::GeneratedAssociationMethods,
 Ahoy::Message::GeneratedAttributeMethods,
 Bullet::SaveWithBulletSupport,
 ActiveRecord::Base,
 ...

* Use milliseconds to match STATEMENT_TIMEOUT units
2021-10-15 11:53:55 -04:00
..
assets Safari CSS gradient bug #14311 (#14938) 2021-10-13 17:38:55 -04:00
black_box Make Rubocop happy again (#14729) 2021-09-14 09:15:01 -05:00
components/admin/users Admin Member view: add Tools::HeaderComponent to reduce duplication (#14558) 2021-08-24 15:08:48 +02:00
controllers ✂✂✂ Remove events (#15062) 2021-10-15 09:31:08 -04:00
decorators ✂️✂️✂️ Remove boosted states from articles (legacy/dead code) (#14977) 2021-10-07 14:39:34 -04:00
errors When a user is blocked from commenting on an article, show correct error message (#15009) 2021-10-14 07:42:08 -06:00
helpers Add I18n date format example (#14973) 2021-10-08 15:08:56 -04:00
javascript make default alt text 'image description' (#15063) 2021-10-13 16:37:34 +01:00
lib Tokenize settings menu and add French translations (#14905) 2021-10-06 17:53:58 +02:00
liquid_tags Remove redundant freeze calls (#14596) 2021-08-26 10:01:08 -04:00
mailers Re-add dynamic delivery_method for ApplicationMailer (#13994) 2021-06-23 15:17:27 -04:00
models Allow Emails::RemoveOldEmailsWorker to run longer (#15085) 2021-10-15 11:53:55 -04:00
policies When a user is blocked from commenting on an article, show correct error message (#15009) 2021-10-14 07:42:08 -06:00
queries Adds validations to avoid creating unnecessary PNs (#14621) 2021-08-31 15:00:30 -06:00
refinements Drop profile columns from user (#10707) 2020-12-03 08:14:38 +07:00
sanitizers Remove redundant freeze calls (#14596) 2021-08-26 10:01:08 -04:00
serializers Remove duplicated work display from header / profile work (#14210) 2021-07-30 12:28:40 +02:00
services ✂✂✂ Remove events (#15062) 2021-10-15 09:31:08 -04:00
uploaders ✂✂✂ Remove events (#15062) 2021-10-15 09:31:08 -04:00
validators Remove redundant freeze calls (#14596) 2021-08-26 10:01:08 -04:00
view_objects Upgrade to Ruby 3.0.2 (#12103) 2021-08-25 14:26:33 -04:00
views ✂✂✂ Remove events (#15062) 2021-10-15 09:31:08 -04:00
workers Allow Emails::RemoveOldEmailsWorker to run longer (#15085) 2021-10-15 11:53:55 -04:00