Sha256: 2a73607119416fc7d44d5021c300d447c92f995b5525428b8419ef1e48508c6c

Contents?: true

Size: 826 Bytes

Versions: 12

Compression:

Stored size: 826 Bytes

Contents

require 'shopapp/panicker_api'

namespace :shopapp do
  # rake shopapp:jobmonit
  desc "check if jobs engine are running"
  task jobmonit: :environment do
    ShopappMonitJob.perform_later
    sleep 15
    timestamp = File.read(Rails.root.join('tmp', 'shopapp_monit_job')).to_datetime
    if Time.now - timestamp > 300
      PanickerApi.general_message "Background jobs delay more than 5 minutes in #{Rails.application.class.parent_name.capitalize}."
    elsif Time.now - timestamp > 60
      PanickerApi.general_message "Background jobs delay more than 1 minutes in #{Rails.application.class.parent_name.capitalize}."
    else
      puts "Jobs are executing fine."
    end
  rescue
    PanickerApi.general_message "Background jobs  error, monit file not found on #{Rails.application.class.parent_name.capitalize}."
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
shopapp-0.77.07 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.76.06 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.76.05 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.76.04 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.75.03 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.75.02 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.73.02 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.3.76 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.2.75 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.2.74 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.2.73 lib/shopapp/tasks/shopapp_job_monitor.rake
shopapp-0.2.72 lib/shopapp/tasks/shopapp_job_monitor.rake