gitlab-org--gitlab-foss/app/workers/admin_email_worker.rb
Toon Claes 6dca7b5b0d Do not send repository check mails when they are disabled
In case the repository checks are disabled, do not send the
mails. Otherwise it might send the same failures over and over again.
2018-05-07 09:42:09 +02:00

17 lines
453 B
Ruby

class AdminEmailWorker
include ApplicationWorker
include CronjobQueue
def perform
send_repository_check_mail if Gitlab::CurrentSettings.repository_checks_enabled
end
private
def send_repository_check_mail
repository_check_failed_count = Project.where(last_repository_check_failed: true).count
return if repository_check_failed_count.zero?
RepositoryCheckMailer.notify(repository_check_failed_count).deliver_now
end
end