Sha256: acdf16332edb853924b601cd95d452d87bf593a2f027059df678626dd8cbe37e

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

require 'set'

module Delayed
  module Heartbeat
    class Plugin < Delayed::Plugin

      callbacks do |lifecycle|
        lifecycle.before(:execute) do |worker|
          if Delayed::Heartbeat.configuration.enabled?
            @heartbeat = Delayed::Heartbeat::WorkerHeartbeat.new(worker.name)
          end
        end

        lifecycle.after(:execute) do |worker|
          @heartbeat.stop if @heartbeat
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
delayed_job_heartbeat_plugin-0.2.0 lib/delayed/heartbeat/plugin.rb
delayed_job_heartbeat_plugin-0.1.0 lib/delayed/heartbeat/plugin.rb