Sha256: 857acde5111ba8e94ba94fd73cf1fc1bf3a3521da6439688ac0c6ab598a14e6e

Contents?: true

Size: 796 Bytes

Versions: 8

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true
# 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

8 entries across 8 versions & 1 rubygems

Version Path
sidekiq-throttled-0.6.7 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.6 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.5 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.4 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.3 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.2 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.1 lib/sidekiq/throttled/web.rb
sidekiq-throttled-0.6.0 lib/sidekiq/throttled/web.rb