Skip to content

Commit

Permalink
Merge pull request #97 from emberobserver/add-build-queue-warning-mailer
Browse files Browse the repository at this point in the history
Add a mailer to email a warning if the build queue isn't empty
  • Loading branch information
pgengler authored Mar 14, 2021
2 parents d7e9bbb + 233ac1a commit ed697b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/mailers/build_queue_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class BuildQueueMailer < ApplicationMailer
def queue_not_empty
@queue_size = PendingBuild.count
mail to: '[email protected]',
from: 'Ember Observer <[email protected]>',
reply_to: '[email protected]',
subject: 'Ember Observer build queue not empty'
end
end
2 changes: 2 additions & 0 deletions app/views/build_queue_mailer/queue_not_empty.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WARNING: The pending build queue is not empty.
There are currently <%= @queue_size %> queued builds.
1 change: 1 addition & 0 deletions config/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
end

every 1.day, at: '0400' do
rake "tests:verify_queue"
rake "tests:queue_canary_tests"
rake "tests:queue_tests"
end
Expand Down
6 changes: 6 additions & 0 deletions lib/tasks/tests.rake
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ namespace :tests do
.select { |version| version.test_results.where(canary: false).count == 0 }
.each { |version| PendingBuild.create!(addon_version: version) }
end

task verify_queue: :environment do
if PendingBuild.count > 0
BuildQueueMailer.queue_not_empty.deliver_now
end
end
end

0 comments on commit ed697b8

Please sign in to comment.