Sha256: 8b591bee50a882aa3fba26dadecde69e9f702d2f853ca6252e41e3ac207e3981

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

# stdlib
require "pathname"

# 3rd party
require "sidekiq"
require "sidekiq/web"

# internal
require "sidekiq/throttled/registry"
require "sidekiq/throttled/web/stats"

module Sidekiq
  module Throttled
    # Provides Sidekiq tab to monitor and reset throttled stats.
    # @private
    module Web
      class << self
        def registered(app)
          template = Pathname.new(__FILE__).join("../web/index.html.erb").read
          app.get("/throttled") { erb template.dup }

          app.delete("/throttled/:id") do
            Registry.get(params[:id], &:reset!)
            redirect "#{root_path}throttled"
          end
        end
      end
    end
  end
end

Sidekiq::Web.register Sidekiq::Throttled::Web
Sidekiq::Web.tabs["Throttled"] = "throttled"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-throttled-0.1.0 lib/sidekiq/throttled/web.rb