Sha256: ba1d1ae33b58afb44667ddbdfd667dce6f96535565798151be1071109a897762

Contents?: true

Size: 637 Bytes

Versions: 7

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

module RailsServerMonitor
  class SidekiqMiddleware
    def call(worker, *opts)
      return if ignore_worker?(worker)

      server = RailsServerMonitor::ServerSetup.new.call
      snapshot = RailsServerMonitor::TakeSnapshot.new(server)

      if snapshot.can_take_snapshot?
        snapshot.call

        RailsServerMonitor::Cleanup.new.call
      end
    end

    def ignore_worker?(worker)
      return false if config.ignore_workers.blank?
      klass_name = worker.class.name

      config.ignore_workers.include?(klass_name)
    end

    def config
      RailsServerMonitor.config
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails-server-monitor-0.1.10 app/middlewares/rails_server_monitor/sidekiq_middleware.rb
rails-server-monitor-0.1.9 app/middlewares/rails_server_monitor/sidekiq_middleware.rb
rails-server-monitor-0.1.8 app/middlewares/rails_server_monitor/sidekiq_middleware.rb
rails-server-monitor-0.1.7 app/middlewares/rails_server_monitor/sidekiq_middleware.rb
rails-server-monitor-0.1.6 app/middlewares/rails_server_monitor/sidekiq_middleware.rb
rails-server-monitor-0.1.5 app/middlewares/rails_server_monitor/sidekiq_middleware.rb
rails-server-monitor-0.1.4 app/middlewares/rails_server_monitor/sidekiq_middleware.rb