Sha256: 4dedcf1cae7ac5036f146ea9514943a2b3fa67a1df08ea7b9a59c3abe96c2da9
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
# frozen_string_literal: true require_relative "web/helpers" module SidekiqUniqueJobs # Utility module to help manage unique keys in redis. # Useful for deleting keys that for whatever reason wasn't deleted # # @author Mikael Henriksson <mikael@mhenrixon.com> module Web def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize app.helpers do include Web::Helpers end app.get "/locks" do @filter = params[:filter] || "*" @filter = "*" if @filter == "" @count = (params[:count] || 100).to_i @current_cursor = params[:cursor] @prev_cursor = params[:prev_cursor] @pagination = { pattern: @filter, cursor: @current_cursor, page_size: @count } @total_size, @next_cursor, @locks = digests.page(**@pagination) erb(unique_template(:locks)) end app.get "/locks/delete_all" do digests.delete_by_pattern("*", count: digests.count) redirect_to :locks end app.get "/locks/:digest" do @digest = params[:digest] @lock = SidekiqUniqueJobs::Lock.new(@digest) erb(unique_template(:lock)) end app.get "/locks/:digest/delete" do digests.delete_by_digest(params[:digest]) redirect_to :locks end app.get "/locks/:digest/jobs/:job_id/delete" do @digest = params[:digest] @lock = SidekiqUniqueJobs::Lock.new(@digest) @lock.unlock(params[:job_id]) redirect_to "locks/#{@lock.key}" end end end end require "sidekiq/web" unless defined?(Sidekiq::Web) Sidekiq::Web.register(SidekiqUniqueJobs::Web) Sidekiq::Web.tabs["Locks"] = "locks" Sidekiq::Web.settings.locales << File.join(File.dirname(__FILE__), "locales")
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-unique-jobs-7.0.0.beta29 | lib/sidekiq_unique_jobs/web.rb |