21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-27 22:40:49 +02:00
This commit is contained in:
Jérémy Lecour 2022-03-02 07:58:33 +03:30 committed by GitHub
commit 5dee73685f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -29,10 +29,15 @@ module CheckProcessor
end
group_finished_at = Time.now
check_ids = checks.map(&:id)
check_logs = check_errors_scope(check_ids: check_ids,
after_date: group_started_at,
before_date: group_finished_at).includes(:check).all
check_errors_scope(check_ids: checks.map(&:id),
after_date: group_started_at,
before_date: group_finished_at).includes(:check).each do |check_log|
message = "#{self.class.name}: #{check_logs.count} error(s) found for checks '#{check_ids.join(',')}' between '#{group_started_at}' and '#{group_finished_at}'" # rubocop:disable Metrics/LineLength
logger.debug(message)
check_logs.each do |check_log|
message = "#{self.class.name}: check ##{check_log.check_id} for '#{check_log.check.domain}' failed (#{check_log.exit_status}) ; #{check_log.error.lines.first}" # rubocop:disable Metrics/LineLength
logger.error(message)
end

View file

@ -5,7 +5,8 @@
set :output, standard: "log/cron.log"
#
job_type :rake_with_stdout, "cd :path && :environment_variable=:environment bundle exec rake :task"
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_method"
@ -19,7 +20,7 @@ set :output, standard: "log/cron.log"
# Learn more: http://github.com/javan/whenever
every 1.day, at: '1:00 am', roles: [:app] do
rake "checks:sync_dates:all"
rake_with_stdout "checks:sync_dates:all VERBOSE=1"
end
every 1.day, at: '8:30 am', roles: [:app] do