Sha256: 010c67bc9b2342ca14eb4e64ca776106f3dee28e14901ed109b042d95e846976

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

require 'vizsla/patches'
require 'vizsla/system_health_sample'
require 'concurrent'

require 'sidekiq/launcher'

::Sidekiq::Launcher.class_eval do
  alias_method :run_without_vizsla, :run
  alias_method :stop_without_vizsla, :stop

  def run
    @vizsla_task = Concurrent::TimerTask.new(execution_interval: 10) do
      health = Vizsla::SystemHealthSample.new process: :worker
      ::Vizsla::Patches.handle_event :sidekiq_health, health
    end

    @vizsla_task.execute

    run_without_vizsla
  end

  def stop
    @vizsla_task.shutdown

    stop_without_vizsla
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tracebin-0.0.7 lib/vizsla/patches/sidekiq_health.rb