-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Job scopes and auto expiration (#1184)
* Job scopes and auto expiration * Tweak log levels * Consolidate Notify key to application config * lint
- Loading branch information
1 parent
4a27d05
commit 1e65d38
Showing
9 changed files
with
49 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'que/active_record/model' | ||
|
||
# by_args | ||
# by_job_class | ||
# by_queue | ||
# by_tag | ||
# | ||
# errored | ||
# expired | ||
# finished | ||
# ready | ||
# scheduled | ||
# | ||
# not_errored | ||
# not_expired | ||
# not_finished | ||
# not_ready | ||
# not_scheduled | ||
# | ||
class Job < Que::ActiveRecord::Model | ||
def self.start_training | ||
by_job_class('StartTrainingMailJob') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
class NotifyDelivery < GovukNotifyRails::Delivery | ||
# Ensure delivery errors do not impede bulk mailout | ||
# @param message [Mail::Message] | ||
# @return [Symbol, Array<Notifications::Client::ResponseNotification>] | ||
def deliver!(message) | ||
super | ||
rescue StandardError | ||
Sentry.capture_message "#{self.class.name} failed: '#{message.display}'", level: :info | ||
Sentry.capture_message "#{self.class.name} failed: '#{message.display}'", level: :error | ||
:skipped_due_to_error | ||
end | ||
end | ||
|
||
ActionMailer::Base.add_delivery_method( | ||
:govuk_notify, | ||
NotifyDelivery, | ||
api_key: ENV.fetch('GOVUK_NOTIFY_API_KEY', Rails.application.credentials.notify_api_key), | ||
:govuk_notify, NotifyDelivery, api_key: Rails.application.config.notify_token | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters