Sha256: 145284a099b7431a92fa919a2342ab152239c44e772137e0cf39529483af2664

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

require 'sidekiq'
require 'net/http'

# A worker to contact deadmanssnitch.com periodically,
# thereby ensuring jobs are being performed and the system
# is healthy.
module Sidekiq
  class Snitch
    include Sidekiq::Worker

    def perform
      if ENV['SIDEKIQ_SNITCH_URL'].present?
        Net::HTTP.get(URI(ENV['SIDEKIQ_SNITCH_URL']))

        minutes = (ENV['SIDEKIQ_SNITCH_MINUTES_DELAY'] || 60).to_i.minutes

        # groundhog day!
        Snitch.perform_in(minutes) unless SidekiqSnitch.scheduled?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq_snitch-1.4.0 app/workers/sidekiq/snitch.rb