sidekiq-unique-jobs 6.0.24 → 7.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq-unique-jobs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +707 -25
- data/README.md +516 -105
- data/lib/sidekiq_unique_jobs.rb +48 -7
- data/lib/sidekiq_unique_jobs/batch_delete.rb +123 -0
- data/lib/sidekiq_unique_jobs/changelog.rb +78 -0
- data/lib/sidekiq_unique_jobs/cli.rb +34 -31
- data/lib/sidekiq_unique_jobs/config.rb +263 -0
- data/lib/sidekiq_unique_jobs/connection.rb +6 -5
- data/lib/sidekiq_unique_jobs/constants.rb +46 -24
- data/lib/sidekiq_unique_jobs/core_ext.rb +80 -0
- data/lib/sidekiq_unique_jobs/digests.rb +71 -100
- data/lib/sidekiq_unique_jobs/exceptions.rb +78 -12
- data/lib/sidekiq_unique_jobs/job.rb +41 -12
- data/lib/sidekiq_unique_jobs/json.rb +40 -0
- data/lib/sidekiq_unique_jobs/key.rb +93 -0
- data/lib/sidekiq_unique_jobs/lock.rb +325 -0
- data/lib/sidekiq_unique_jobs/lock/base_lock.rb +66 -50
- data/lib/sidekiq_unique_jobs/lock/client_validator.rb +28 -0
- data/lib/sidekiq_unique_jobs/lock/server_validator.rb +27 -0
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +7 -10
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +6 -6
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_expired.rb +4 -21
- data/lib/sidekiq_unique_jobs/lock/validator.rb +96 -0
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +13 -9
- data/lib/sidekiq_unique_jobs/lock/while_executing_reject.rb +3 -3
- data/lib/sidekiq_unique_jobs/lock_args.rb +123 -0
- data/lib/sidekiq_unique_jobs/lock_config.rb +122 -0
- data/lib/sidekiq_unique_jobs/lock_digest.rb +79 -0
- data/lib/sidekiq_unique_jobs/lock_info.rb +68 -0
- data/lib/sidekiq_unique_jobs/lock_timeout.rb +62 -0
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +77 -0
- data/lib/sidekiq_unique_jobs/locksmith.rb +261 -101
- data/lib/sidekiq_unique_jobs/logging.rb +149 -23
- data/lib/sidekiq_unique_jobs/logging/middleware_context.rb +44 -0
- data/lib/sidekiq_unique_jobs/lua/delete.lua +51 -0
- data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +42 -0
- data/lib/sidekiq_unique_jobs/lua/delete_job_by_digest.lua +38 -0
- data/lib/sidekiq_unique_jobs/lua/find_digest_in_queues.lua +26 -0
- data/lib/sidekiq_unique_jobs/lua/lock.lua +93 -0
- data/lib/sidekiq_unique_jobs/lua/locked.lua +35 -0
- data/lib/sidekiq_unique_jobs/lua/queue.lua +87 -0
- data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +94 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_common.lua +40 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_current_time.lua +8 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_delete_from_queue.lua +22 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua +18 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +53 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_queues.lua +43 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua +24 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_hgetall.lua +13 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_upgrades.lua +3 -0
- data/lib/sidekiq_unique_jobs/lua/unlock.lua +95 -0
- data/lib/sidekiq_unique_jobs/lua/update_version.lua +40 -0
- data/lib/sidekiq_unique_jobs/lua/upgrade.lua +68 -0
- data/lib/sidekiq_unique_jobs/middleware.rb +29 -31
- data/lib/sidekiq_unique_jobs/middleware/client.rb +42 -0
- data/lib/sidekiq_unique_jobs/middleware/server.rb +27 -0
- data/lib/sidekiq_unique_jobs/normalizer.rb +4 -4
- data/lib/sidekiq_unique_jobs/on_conflict.rb +23 -10
- data/lib/sidekiq_unique_jobs/on_conflict/log.rb +9 -5
- data/lib/sidekiq_unique_jobs/on_conflict/null_strategy.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/raise.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +61 -15
- data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +54 -14
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +12 -5
- data/lib/sidekiq_unique_jobs/on_conflict/strategy.rb +25 -6
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +41 -27
- data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +29 -0
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +212 -0
- data/lib/sidekiq_unique_jobs/orphans/null_reaper.rb +24 -0
- data/lib/sidekiq_unique_jobs/orphans/observer.rb +42 -0
- data/lib/sidekiq_unique_jobs/orphans/reaper.rb +114 -0
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +201 -0
- data/lib/sidekiq_unique_jobs/redis.rb +11 -0
- data/lib/sidekiq_unique_jobs/redis/entity.rb +106 -0
- data/lib/sidekiq_unique_jobs/redis/hash.rb +56 -0
- data/lib/sidekiq_unique_jobs/redis/list.rb +32 -0
- data/lib/sidekiq_unique_jobs/redis/set.rb +32 -0
- data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +86 -0
- data/lib/sidekiq_unique_jobs/redis/string.rb +49 -0
- data/lib/sidekiq_unique_jobs/rspec/matchers.rb +26 -0
- data/lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb +51 -0
- data/lib/sidekiq_unique_jobs/script.rb +15 -0
- data/lib/sidekiq_unique_jobs/script/caller.rb +125 -0
- data/lib/sidekiq_unique_jobs/server.rb +48 -0
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +92 -65
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +185 -34
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +11 -5
- data/lib/sidekiq_unique_jobs/testing.rb +62 -21
- data/lib/sidekiq_unique_jobs/timer_task.rb +78 -0
- data/lib/sidekiq_unique_jobs/timing.rb +58 -0
- data/lib/sidekiq_unique_jobs/unlockable.rb +20 -4
- data/lib/sidekiq_unique_jobs/update_version.rb +25 -0
- data/lib/sidekiq_unique_jobs/upgrade_locks.rb +155 -0
- data/lib/sidekiq_unique_jobs/version.rb +3 -1
- data/lib/sidekiq_unique_jobs/version_check.rb +23 -4
- data/lib/sidekiq_unique_jobs/web.rb +50 -27
- data/lib/sidekiq_unique_jobs/web/helpers.rb +125 -10
- data/lib/sidekiq_unique_jobs/web/views/changelogs.erb +54 -0
- data/lib/sidekiq_unique_jobs/web/views/lock.erb +108 -0
- data/lib/sidekiq_unique_jobs/web/views/locks.erb +52 -0
- data/lib/tasks/changelog.rake +5 -5
- metadata +117 -177
- data/lib/sidekiq_unique_jobs/client/middleware.rb +0 -56
- data/lib/sidekiq_unique_jobs/scripts.rb +0 -118
- data/lib/sidekiq_unique_jobs/server/middleware.rb +0 -46
- data/lib/sidekiq_unique_jobs/timeout.rb +0 -8
- data/lib/sidekiq_unique_jobs/timeout/calculator.rb +0 -63
- data/lib/sidekiq_unique_jobs/unique_args.rb +0 -150
- data/lib/sidekiq_unique_jobs/util.rb +0 -103
- data/lib/sidekiq_unique_jobs/web/views/unique_digest.erb +0 -28
- data/lib/sidekiq_unique_jobs/web/views/unique_digests.erb +0 -46
- data/redis/acquire_lock.lua +0 -21
- data/redis/convert_legacy_lock.lua +0 -13
- data/redis/delete.lua +0 -14
- data/redis/delete_by_digest.lua +0 -23
- data/redis/delete_job_by_digest.lua +0 -60
- data/redis/lock.lua +0 -62
- data/redis/release_stale_locks.lua +0 -90
- data/redis/unlock.lua +0 -35
@@ -4,13 +4,13 @@ module SidekiqUniqueJobs
|
|
4
4
|
#
|
5
5
|
# Handles checking if a version is compliant with given constraint
|
6
6
|
#
|
7
|
-
# @author Mikael Henriksson <mikael@
|
7
|
+
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
8
8
|
#
|
9
9
|
class VersionCheck
|
10
|
-
PATTERN = /(?<operator1>[<>=]+)?\s?(?<version1>(\d+.?)+)(\s+&&\s+)?(?<operator2>[<>=]+)?\s?(?<version2>(\d+.?)+)?/m.freeze # rubocop:disable Layout/LineLength
|
10
|
+
PATTERN = /(?<operator1>[<>=]+)?\s?(?<version1>(\d+.?)+)(\s+&&\s+)?(?<operator2>[<>=]+)?\s?(?<version2>(\d+.?)+)?/m.freeze # rubocop:disable Layout/LineLength, Lint/MixedRegexpCaptureTypes
|
11
11
|
|
12
12
|
#
|
13
|
-
# Checks if a version is
|
13
|
+
# Checks if a version is constraint is satisfied
|
14
14
|
#
|
15
15
|
# @example A satisfied constraint
|
16
16
|
# VersionCheck.satisfied?("5.0.0", ">= 4.0.0") #=> true
|
@@ -22,12 +22,31 @@ module SidekiqUniqueJobs
|
|
22
22
|
# @param [String] version a version string `5.0.0`
|
23
23
|
# @param [String] constraint a version constraint `>= 5.0.0 <= 5.1.1`
|
24
24
|
#
|
25
|
-
# @return [
|
25
|
+
# @return [true, false] <description>
|
26
26
|
#
|
27
27
|
def self.satisfied?(version, constraint)
|
28
28
|
new(version, constraint).satisfied?
|
29
29
|
end
|
30
30
|
|
31
|
+
#
|
32
|
+
# Checks if a version is constraint is unfulfilled
|
33
|
+
#
|
34
|
+
# @example A satisfied constraint
|
35
|
+
# VersionCheck.unfulfilled?("5.0.0", ">= 4.0.0") #=> false
|
36
|
+
#
|
37
|
+
# @example An unfulfilled constraint
|
38
|
+
# VersionCheck.unfulfilled?("5.0.0", "<= 4.0.0") #=> true
|
39
|
+
#
|
40
|
+
#
|
41
|
+
# @param [String] version a version string `5.0.0`
|
42
|
+
# @param [String] constraint a version constraint `>= 5.0.0 <= 5.1.1`
|
43
|
+
#
|
44
|
+
# @return [true, false] <description>
|
45
|
+
#
|
46
|
+
def self.unfulfilled?(version, constraint)
|
47
|
+
!satisfied?(version, constraint)
|
48
|
+
end
|
49
|
+
|
31
50
|
#
|
32
51
|
# @!attribute [r] version
|
33
52
|
# @return [String] a version string `5.0.0`
|
@@ -1,60 +1,83 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
begin
|
4
|
-
require "delegate"
|
5
|
-
require "rack"
|
6
|
-
require "sidekiq/web"
|
7
|
-
rescue LoadError
|
8
|
-
# client-only usage
|
9
|
-
end
|
10
|
-
|
11
3
|
require_relative "web/helpers"
|
12
4
|
|
13
5
|
module SidekiqUniqueJobs
|
14
6
|
# Utility module to help manage unique keys in redis.
|
15
7
|
# Useful for deleting keys that for whatever reason wasn't deleted
|
16
8
|
#
|
17
|
-
# @author Mikael Henriksson <mikael@
|
9
|
+
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
18
10
|
module Web
|
19
|
-
def self.registered(app) # rubocop:disable Metrics/MethodLength
|
11
|
+
def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
20
12
|
app.helpers do
|
21
13
|
include Web::Helpers
|
22
14
|
end
|
23
15
|
|
24
|
-
app.get "/
|
16
|
+
app.get "/changelogs" do
|
25
17
|
@filter = params[:filter] || "*"
|
26
18
|
@filter = "*" if @filter == ""
|
27
19
|
@count = (params[:count] || 100).to_i
|
28
20
|
@current_cursor = params[:cursor]
|
29
21
|
@prev_cursor = params[:prev_cursor]
|
30
|
-
@
|
31
|
-
|
22
|
+
@pagination = { pattern: @filter, cursor: @current_cursor, page_size: @count }
|
23
|
+
@total_size, @next_cursor, @changelogs = changelog.page(**@pagination)
|
32
24
|
|
33
|
-
erb(unique_template(:
|
25
|
+
erb(unique_template(:changelogs))
|
34
26
|
end
|
35
27
|
|
36
|
-
app.get "/
|
37
|
-
|
38
|
-
redirect_to :
|
28
|
+
app.get "/changelogs/delete_all" do
|
29
|
+
changelog.clear
|
30
|
+
redirect_to :changelogs
|
39
31
|
end
|
40
32
|
|
41
|
-
app.get "/
|
33
|
+
app.get "/locks" do
|
34
|
+
@filter = params[:filter] || "*"
|
35
|
+
@filter = "*" if @filter == ""
|
36
|
+
@count = (params[:count] || 100).to_i
|
37
|
+
@current_cursor = params[:cursor]
|
38
|
+
@prev_cursor = params[:prev_cursor]
|
39
|
+
@pagination = { pattern: @filter, cursor: @current_cursor, page_size: @count }
|
40
|
+
@total_size, @next_cursor, @locks = digests.page(**@pagination)
|
41
|
+
|
42
|
+
erb(unique_template(:locks))
|
43
|
+
end
|
44
|
+
|
45
|
+
app.get "/locks/delete_all" do
|
46
|
+
digests.delete_by_pattern("*", count: digests.count)
|
47
|
+
redirect_to :locks
|
48
|
+
end
|
49
|
+
|
50
|
+
app.get "/locks/:digest" do
|
42
51
|
@digest = params[:digest]
|
43
|
-
@
|
52
|
+
@lock = SidekiqUniqueJobs::Lock.new(@digest)
|
44
53
|
|
45
|
-
erb(unique_template(:
|
54
|
+
erb(unique_template(:lock))
|
46
55
|
end
|
47
56
|
|
48
|
-
app.get "/
|
49
|
-
|
50
|
-
redirect_to :
|
57
|
+
app.get "/locks/:digest/delete" do
|
58
|
+
digests.delete_by_digest(params[:digest])
|
59
|
+
redirect_to :locks
|
60
|
+
end
|
61
|
+
|
62
|
+
app.get "/locks/:digest/jobs/:job_id/delete" do
|
63
|
+
@digest = params[:digest]
|
64
|
+
@lock = SidekiqUniqueJobs::Lock.new(@digest)
|
65
|
+
@lock.unlock(params[:job_id])
|
66
|
+
|
67
|
+
redirect_to "locks/#{@lock.key}"
|
51
68
|
end
|
52
69
|
end
|
53
70
|
end
|
54
71
|
end
|
55
72
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
73
|
+
begin
|
74
|
+
require "delegate" unless defined?(DelegateClass)
|
75
|
+
require "sidekiq/web" unless defined?(Sidekiq::Web)
|
76
|
+
|
77
|
+
Sidekiq::Web.register(SidekiqUniqueJobs::Web)
|
78
|
+
Sidekiq::Web.tabs["Locks"] = "locks"
|
79
|
+
Sidekiq::Web.tabs["Changelogs"] = "changelogs"
|
80
|
+
Sidekiq::Web.settings.locales << File.join(File.dirname(__FILE__), "locales")
|
81
|
+
rescue NameError, LoadError => ex
|
82
|
+
SidekiqUniqueJobs.logger.error(ex)
|
60
83
|
end
|
@@ -2,20 +2,73 @@
|
|
2
2
|
|
3
3
|
module SidekiqUniqueJobs
|
4
4
|
module Web
|
5
|
+
#
|
6
|
+
# Provides view helpers for the Sidekiq::Web extension
|
7
|
+
#
|
8
|
+
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
9
|
+
#
|
5
10
|
module Helpers
|
6
|
-
|
11
|
+
#
|
12
|
+
# @return [String] the path to gem specific views
|
13
|
+
VIEW_PATH = File.expand_path("../web/views", __dir__).freeze
|
14
|
+
#
|
15
|
+
# @return [Array<String>] safe params
|
16
|
+
SAFE_CPARAMS = %w[cursor prev_cursor].freeze
|
17
|
+
|
18
|
+
extend self
|
7
19
|
|
20
|
+
#
|
21
|
+
# Opens a template file contained within this gem
|
22
|
+
#
|
23
|
+
# @param [Symbol] name the name of the template
|
24
|
+
#
|
25
|
+
# @return [String] the file contents of the template
|
26
|
+
#
|
8
27
|
def unique_template(name)
|
9
|
-
File.open(
|
28
|
+
File.open(unique_filename(name)).read
|
10
29
|
end
|
11
30
|
|
12
|
-
|
31
|
+
#
|
32
|
+
# Construct template file name
|
33
|
+
#
|
34
|
+
# @param [Symbol] name the name of the template
|
35
|
+
#
|
36
|
+
# @return [String] the full name of the file
|
37
|
+
#
|
38
|
+
def unique_filename(name)
|
39
|
+
File.join(VIEW_PATH, "#{name}.erb")
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# The collection of digests
|
44
|
+
#
|
45
|
+
#
|
46
|
+
# @return [SidekiqUniqueJobs::Digests] the sorted set with digests
|
47
|
+
#
|
48
|
+
def digests
|
49
|
+
@digests ||= SidekiqUniqueJobs::Digests.new
|
50
|
+
end
|
13
51
|
|
52
|
+
#
|
53
|
+
# The collection of changelog entries
|
54
|
+
#
|
55
|
+
#
|
56
|
+
# @return [SidekiqUniqueJobs::Digests] the sorted set with digests
|
57
|
+
#
|
58
|
+
def changelog
|
59
|
+
@changelog ||= SidekiqUniqueJobs::Changelog.new
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Creates url safe parameters
|
64
|
+
#
|
65
|
+
# @param [Hash] options the key/value to parameterize
|
66
|
+
#
|
67
|
+
# @return [String] a url safe parameter string
|
68
|
+
#
|
14
69
|
def cparams(options)
|
15
70
|
# stringify
|
16
|
-
options.
|
17
|
-
options[key.to_s] = options.delete(key)
|
18
|
-
end
|
71
|
+
options.transform_keys(&:to_s)
|
19
72
|
|
20
73
|
params.merge(options).map do |key, value|
|
21
74
|
next unless SAFE_CPARAMS.include?(key)
|
@@ -24,6 +77,35 @@ module SidekiqUniqueJobs
|
|
24
77
|
end.compact.join("&")
|
25
78
|
end
|
26
79
|
|
80
|
+
#
|
81
|
+
# Used to avoid incompatibility with older sidekiq versions
|
82
|
+
#
|
83
|
+
#
|
84
|
+
# @param [Array] args the unique arguments to display
|
85
|
+
# @param [Integer] truncate_after_chars
|
86
|
+
#
|
87
|
+
# @return [String] a string containing all non-truncated arguments
|
88
|
+
#
|
89
|
+
def display_lock_args(args, truncate_after_chars = 2000)
|
90
|
+
return "Invalid job payload, args is nil" if args.nil?
|
91
|
+
return "Invalid job payload, args must be an Array, not #{args.class.name}" unless args.is_a?(Array)
|
92
|
+
|
93
|
+
begin
|
94
|
+
args.map do |arg|
|
95
|
+
h(truncate(to_display(arg), truncate_after_chars))
|
96
|
+
end.join(", ")
|
97
|
+
rescue StandardError
|
98
|
+
"Illegal job arguments: #{h args.inspect}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# Redirect to with falback
|
104
|
+
#
|
105
|
+
# @param [String] subpath the path to redirect to
|
106
|
+
#
|
107
|
+
# @return a redirect to the new subpath
|
108
|
+
#
|
27
109
|
def redirect_to(subpath)
|
28
110
|
if respond_to?(:to)
|
29
111
|
# Sinatra-based web UI
|
@@ -34,14 +116,47 @@ module SidekiqUniqueJobs
|
|
34
116
|
end
|
35
117
|
end
|
36
118
|
|
119
|
+
#
|
120
|
+
# Gets a relative time as html
|
121
|
+
#
|
122
|
+
# @param [Time] time an instance of Time
|
123
|
+
#
|
124
|
+
# @return [String] a html safe string with relative time information
|
125
|
+
#
|
126
|
+
def relative_time(time)
|
127
|
+
stamp = time.getutc.iso8601
|
128
|
+
%(<time class="ltr" dir="ltr" title="#{stamp}" datetime="#{stamp}">#{time}</time>)
|
129
|
+
end
|
130
|
+
|
131
|
+
#
|
132
|
+
# Gets a relative time as html without crashing
|
133
|
+
#
|
134
|
+
# @param [Float, Integer, String, Time] time a representation of a timestamp
|
135
|
+
#
|
136
|
+
# @return [String] a html safe string with relative time information
|
137
|
+
#
|
37
138
|
def safe_relative_time(time)
|
38
|
-
time =
|
139
|
+
time = parse_time(time)
|
140
|
+
|
141
|
+
relative_time(time)
|
142
|
+
end
|
143
|
+
|
144
|
+
#
|
145
|
+
# Constructs a time from a number of different types
|
146
|
+
#
|
147
|
+
# @param [Float, Integer, String, Time] time a representation of a timestamp
|
148
|
+
#
|
149
|
+
# @return [Time]
|
150
|
+
#
|
151
|
+
def parse_time(time)
|
152
|
+
case time
|
153
|
+
when Time
|
154
|
+
time
|
155
|
+
when Integer, Float
|
39
156
|
Time.at(time)
|
40
157
|
else
|
41
|
-
Time.parse(time)
|
158
|
+
Time.parse(time.to_s)
|
42
159
|
end
|
43
|
-
|
44
|
-
relative_time(time)
|
45
160
|
end
|
46
161
|
end
|
47
162
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<header class="row">
|
2
|
+
<div class="col-sm-5">
|
3
|
+
<h3>
|
4
|
+
<%= t('Changelog Entries') %>
|
5
|
+
</h3>
|
6
|
+
</div>
|
7
|
+
<form action="<%= root_path %>changelogs" class="form form-inline" method="get">
|
8
|
+
<%= csrf_tag %>
|
9
|
+
<input name="filter" class="form-control" type="text" value="<%= @filter %>" />
|
10
|
+
<button class="btn btn-default" type="submit">
|
11
|
+
<%= t('Filter') %>
|
12
|
+
</button>
|
13
|
+
</form>
|
14
|
+
<% if @changelogs.any? && @total_size > @count.to_i %>
|
15
|
+
<div class="col-sm-4">
|
16
|
+
<%= erb unique_template(:_paging), locals: { url: "#{root_path}changelogs" } %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
</header>
|
20
|
+
<% if @changelogs.any? %>
|
21
|
+
<div class="table_container">
|
22
|
+
<form action="<%= root_path %>changelogs/delete_all" method="get">
|
23
|
+
<input class="btn btn-danger btn-xs" type="submit" name="delete_all" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSure') %>" />
|
24
|
+
</form>
|
25
|
+
<br/>
|
26
|
+
<table class="table table-striped table-bordered table-hover">
|
27
|
+
<thead>
|
28
|
+
<tr>
|
29
|
+
<th><%= t('Time') %></th>
|
30
|
+
<th><%= t('Digest') %></th>
|
31
|
+
<th><%= t('Script') %></th>
|
32
|
+
<th><%= t('JID') %></th>
|
33
|
+
<th><%= t('Prev JID') %></th>
|
34
|
+
<th><%= t('Message') %></th>
|
35
|
+
</tr>
|
36
|
+
</thead>
|
37
|
+
<tbody>
|
38
|
+
<% @changelogs.each do |changelog| %>
|
39
|
+
<tr>
|
40
|
+
<td><%= safe_relative_time(changelog["time"]) %></td>
|
41
|
+
<td><%= changelog["digest"] %></td>
|
42
|
+
<td><%= changelog["script"] %></td>
|
43
|
+
<td><%= changelog["job_id"] %></td>
|
44
|
+
<td><%= changelog["prev_jid"] %></td>
|
45
|
+
<td><%= changelog["message"] %></th>
|
46
|
+
</tr>
|
47
|
+
<% end %>
|
48
|
+
</tbody>
|
49
|
+
</table>
|
50
|
+
<form action="<%= root_path %>changelogs/delete_all" method="get">
|
51
|
+
<input class="btn btn-danger btn-xs" type="submit" name="delete_all" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSure') %>" />
|
52
|
+
</form>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
@@ -0,0 +1,108 @@
|
|
1
|
+
<header class="row">
|
2
|
+
<div class="col-sm-5">
|
3
|
+
<h3>
|
4
|
+
<%= t('Lock information') %> <a class="btn btn-default btn-xs" href="<%= root_path %>locks"><%= t('GoBack') %></a>
|
5
|
+
</h3>
|
6
|
+
</div>
|
7
|
+
<div class="col-sm-7 table-responsive">
|
8
|
+
<% if @lock.info.none? %>
|
9
|
+
<h3>No Lock Information Available</h3>
|
10
|
+
<p>To use it turn the following setting on:
|
11
|
+
<code>SidekiqUniqueJobs.config.lock_info = true</code>
|
12
|
+
</p>
|
13
|
+
<% else %>
|
14
|
+
<table class="table table-striped table-bordered table-white table-hover">
|
15
|
+
<caption>Information about lock</caption>
|
16
|
+
<tbody>
|
17
|
+
<tr>
|
18
|
+
<th scope=row><%= t('Worker') %></td>
|
19
|
+
<td><%= @lock.info["worker"] %></td>
|
20
|
+
</tr>
|
21
|
+
<tr>
|
22
|
+
<th scope=row><%= t('Queue') %></td>
|
23
|
+
<td><%= @lock.info["queue"] %></td>
|
24
|
+
</tr>
|
25
|
+
<tr>
|
26
|
+
<th scope=row><%= t('Limit') %></td>
|
27
|
+
<td><%= @lock.info["limit"] %></td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<th scope=row><%= t('TTL') %></td>
|
31
|
+
<td><%= @lock.info["ttl"] %></td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<th scope=row><%= t('Timeout') %></td>
|
35
|
+
<td><%= @lock.info["timeout"] %></td>
|
36
|
+
</tr>
|
37
|
+
<tr>
|
38
|
+
<th scope=row><%= t('Args') %></td>
|
39
|
+
<td>
|
40
|
+
<code class="code-wrap">
|
41
|
+
<!-- We don't want to truncate any job arguments when viewing a single job's status page -->
|
42
|
+
<div class="args-extended"><%= display_lock_args(@lock.info["lock_args"], nil) %></div>
|
43
|
+
</code>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
</tbody>
|
47
|
+
</table>
|
48
|
+
<% end %>
|
49
|
+
</div>
|
50
|
+
</header>
|
51
|
+
<div class="row">
|
52
|
+
<div class="col-sm-6 table-responsive">
|
53
|
+
<table class="table table-striped table-bordered table-hover">
|
54
|
+
<caption>Digest: <strong class="text-muted"><%= @lock.key %></strong></caption>
|
55
|
+
<thead>
|
56
|
+
<tr>
|
57
|
+
<th scope="col"><%= t('Locked JIDs') %></th>
|
58
|
+
<th scope="col"><%= t('Since') %></th>
|
59
|
+
<th scope="col"></th>
|
60
|
+
</tr>
|
61
|
+
</thead>
|
62
|
+
<tbody>
|
63
|
+
<% @lock.locked_jids(with_values: true).each do |job_id, time| %>
|
64
|
+
<tr>
|
65
|
+
<td><%= job_id %></td>
|
66
|
+
<td><%= safe_relative_time(time.to_f) %></td>
|
67
|
+
<td>
|
68
|
+
<form action="<%= root_path %>locks/<%= @lock.key %>/jobs/<%= job_id %>/delete" method="get">
|
69
|
+
<%= csrf_tag %>
|
70
|
+
<input class="btn btn-danger btn-xs flip" type="submit" name="delete" value="<%= t('Unlock') %>" data-confirm="<%= t('AreYouSure') %>" />
|
71
|
+
</form>
|
72
|
+
</td>
|
73
|
+
</tr>
|
74
|
+
<% end %>
|
75
|
+
</tbody>
|
76
|
+
</table>
|
77
|
+
</div>
|
78
|
+
<div class="col-sm-6 table-responsive">
|
79
|
+
<% if @lock.changelog.count.positive? %>
|
80
|
+
<table class="table table-striped table-bordered table-hover">
|
81
|
+
<caption>Changelogs</caption>
|
82
|
+
<thead>
|
83
|
+
<tr>
|
84
|
+
<th scope="col"><%= t('At') %></th>
|
85
|
+
<th scope="col"><%= t('JID') %></th>
|
86
|
+
<th scope="col"><%= t('Message') %></th>
|
87
|
+
<th scope="col"><%= t('Script') %></th>
|
88
|
+
</tr>
|
89
|
+
</thead>
|
90
|
+
<tbody>
|
91
|
+
<% @lock.changelogs.each do |entry| %>
|
92
|
+
<tr>
|
93
|
+
<td scope="row"><%= safe_relative_time(entry["time"].to_f) %></td>
|
94
|
+
<td><%= entry["job_id"] %></td>
|
95
|
+
<td><%= entry["message"] %></td>
|
96
|
+
<td><%= entry["script"] %></td>
|
97
|
+
</tr>
|
98
|
+
<% end %>
|
99
|
+
</tbody>
|
100
|
+
</table>
|
101
|
+
<% end %>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
<form action="<%= root_path %>locks/<%= @lock.key %>/delete" method="get">
|
105
|
+
<%= csrf_tag %>
|
106
|
+
<a class="btn btn-default btn-xs" href="<%= root_path %>locks"><%= t('GoBack') %></a>
|
107
|
+
<input class="btn btn-danger btn-xs flip" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
|
108
|
+
</form>
|