2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-04-04 11:23:43 -04:00
|
|
|
class AdminEmailWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-10-21 12:13:41 -04:00
|
|
|
include CronjobQueue
|
2016-04-04 11:23:43 -04:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category_not_owned!
|
|
|
|
|
2016-04-04 11:23:43 -04:00
|
|
|
def perform
|
2018-04-19 10:03:56 -04:00
|
|
|
send_repository_check_mail if Gitlab::CurrentSettings.repository_checks_enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-04-19 10:03:56 -04:00
|
|
|
def send_repository_check_mail
|
2016-04-06 07:47:05 -04:00
|
|
|
repository_check_failed_count = Project.where(last_repository_check_failed: true).count
|
|
|
|
return if repository_check_failed_count.zero?
|
2016-04-04 11:23:43 -04:00
|
|
|
|
2016-04-06 07:47:05 -04:00
|
|
|
RepositoryCheckMailer.notify(repository_check_failed_count).deliver_now
|
2016-04-04 11:23:43 -04:00
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2016-04-04 11:23:43 -04:00
|
|
|
end
|