Skip to content

Commit

Permalink
Post test teaks (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdavidhamilton authored May 17, 2024
1 parent 1e65d38 commit e00647c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/notify-callback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- name: Mock callback
run: |
curl \
--no-progress-meter \
--request POST \
--header 'BOT: ${{ secrets.BOT_TOKEN }}' \
--header 'Content-type: application/json' \
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/hook_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def change
# @see https://docs.notifications.service.gov.uk/ruby.html#delivery-receipts
def notify
user = User.find_by(email: payload['to'])
user.update!(notify_callback: payload)
user.update!(notify_callback: payload) if user
render json: { status: 'callback received' }, status: :ok
end

Expand Down
2 changes: 1 addition & 1 deletion app/jobs/application_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def handle_error(error)
# @param level [Symbol]
# @return [String]
def log(message, level = :info)
message = "#{ENV['DOMAIN']} - #{self.class.name} #{message}"
message = "#{self.class.name} in #{ENV['ENVIRONMENT']}: #{message}"
Sentry.capture_message(message, level: level) if Rails.env.production?

if ENV['RAILS_LOG_TO_STDOUT'].present?
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/content_check_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ContentCheckJob < ApplicationJob
# @return [Boolean]
def run(*)
Training::Module.cache.clear
log "#{self.class.name}: Running in '#{env}' via '#{api}'"
log "Running in '#{env}' via '#{api}'"
valid?
end

Expand All @@ -17,7 +17,7 @@ def valid?
log Training::Module.cache.size # should be larger than 0

unless check.valid?
log "ContentCheckJob: #{mod.name} in '#{env}' via '#{api}' is not valid", :warn
log "#{mod.name} in '#{env}' via '#{api}' is not valid", :warn
end

check.valid?
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/dashboard_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DashboardJob < ApplicationJob
# @param upload [Boolean] defaults to true in production or if $DASHBOARD_UPDATE exists
def run(upload: Rails.application.dashboard?)
super do
log "DashboardJob: Running upload=#{upload}"
log "upload=#{upload}"

Dashboard.new(path: build_dir).call(upload: upload, clean: true)
end
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/mail_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.recipients
end

def run(*)
log "#{self.class.name}: #{self.class.recipients.count} recipients"
log "#{self.class.recipients.count} recipients"

super
end
Expand Down
6 changes: 3 additions & 3 deletions app/jobs/new_module_mail_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class NewModuleMailJob < MailJob
# @param release_id [Integer]
def run(release_id)
super do
log "Cache key: #{Training::Module.cache_key}"
log 'Recalculating key...'
log "cache key #{Training::Module.cache_key}"
log 'recalculating key...'
Training::Module.reset_cache_key!
log "Cache key: #{Training::Module.cache_key}"
log "cache key #{Training::Module.cache_key}"

return :no_new_module unless new_module_published?

Expand Down

0 comments on commit e00647c

Please sign in to comment.