-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move until_expired digests to separate zset
- Loading branch information
1 parent
efb3d89
commit b490edd
Showing
19 changed files
with
163 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module SidekiqUniqueJobs | ||
# | ||
# Class ExpiringDigests provides access to the expiring digests used by until_expired locks | ||
# | ||
# @author Mikael Henriksson <[email protected]> | ||
# | ||
class ExpiringDigests < Digests | ||
def initialize | ||
super(EXPIRING_DIGESTS) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ module SidekiqUniqueJobs | |
# | ||
# @author Mikael Henriksson <[email protected]> | ||
module Web | ||
def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize | ||
def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity | ||
app.helpers do | ||
include Web::Helpers | ||
end | ||
|
@@ -49,8 +49,25 @@ def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize | |
erb(unique_template(:locks)) | ||
end | ||
|
||
app.get "/expiring_locks" do | ||
@filter = params[:filter] || "*" | ||
@filter = "*" if @filter == "" | ||
@count = (params[:count] || 100).to_i | ||
@current_cursor = params[:cursor] | ||
@prev_cursor = params[:prev_cursor] | ||
|
||
@total_size, @next_cursor, @locks = expiring_digests.page( | ||
cursor: @current_cursor, | ||
pattern: @filter, | ||
page_size: @count, | ||
) | ||
|
||
erb(unique_template(:locks)) | ||
end | ||
|
||
app.get "/locks/delete_all" do | ||
digests.delete_by_pattern("*", count: digests.count) | ||
expiring_digests.delete_by_pattern("*", count: digests.count) | ||
redirect_to :locks | ||
end | ||
|
||
|
@@ -63,6 +80,7 @@ def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize | |
|
||
app.get "/locks/:digest/delete" do | ||
digests.delete_by_digest(params[:digest]) | ||
expiring_digests.delete_by_digest(params[:digest]) | ||
redirect_to :locks | ||
end | ||
|
||
|
@@ -82,8 +100,9 @@ def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize | |
require "sidekiq/web" unless defined?(Sidekiq::Web) | ||
|
||
Sidekiq::Web.register(SidekiqUniqueJobs::Web) | ||
Sidekiq::Web.tabs["Locks"] = "locks" | ||
Sidekiq::Web.tabs["Changelogs"] = "changelogs" | ||
Sidekiq::Web.tabs["Locks"] = "locks" | ||
Sidekiq::Web.tabs["Expiring Locks"] = "expiring_locks" | ||
Sidekiq::Web.tabs["Changelogs"] = "changelogs" | ||
Sidekiq::Web.settings.locales << File.join(File.dirname(__FILE__), "locales") | ||
rescue NameError, LoadError => ex | ||
SidekiqUniqueJobs.logger.error(ex) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
#{digest_one}:INFO | ||
uniquejobs:changelog | ||
uniquejobs:digests | ||
uniquejobs:expiring_digests | ||
], | ||
) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.