sidekiq-unique-jobs 7.0.0.beta27 → 7.0.2
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 +90 -14
- data/README.md +162 -30
- data/lib/sidekiq-unique-jobs.rb +0 -2
- data/lib/sidekiq_unique_jobs.rb +1 -0
- data/lib/sidekiq_unique_jobs/batch_delete.rb +1 -1
- data/lib/sidekiq_unique_jobs/changelog.rb +11 -4
- data/lib/sidekiq_unique_jobs/config.rb +2 -2
- data/lib/sidekiq_unique_jobs/constants.rb +2 -0
- data/lib/sidekiq_unique_jobs/digests.rb +1 -1
- data/lib/sidekiq_unique_jobs/job.rb +1 -1
- data/lib/sidekiq_unique_jobs/json.rb +7 -1
- data/lib/sidekiq_unique_jobs/lock.rb +31 -1
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_config.rb +2 -0
- data/lib/sidekiq_unique_jobs/locksmith.rb +1 -1
- data/lib/sidekiq_unique_jobs/lua/lock.lua +10 -11
- data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +8 -7
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +9 -2
- data/lib/sidekiq_unique_jobs/middleware.rb +0 -57
- data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +9 -8
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +1 -1
- data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
- data/lib/sidekiq_unique_jobs/orphans/reaper.rb +10 -0
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +14 -5
- data/lib/sidekiq_unique_jobs/redis/entity.rb +9 -3
- data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +27 -0
- data/lib/sidekiq_unique_jobs/server.rb +48 -0
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +1 -1
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/sidekiq_unique_jobs/web.rb +26 -9
- data/lib/sidekiq_unique_jobs/web/helpers.rb +24 -3
- data/lib/sidekiq_unique_jobs/web/views/changelogs.erb +54 -0
- data/lib/sidekiq_unique_jobs/web/views/locks.erb +1 -1
- metadata +12 -8
- data/lib/sidekiq_unique_jobs/profiler.rb +0 -55
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SidekiqUniqueJobs
|
4
|
-
#
|
5
|
-
# Class MethodProfiler provides method level profiling
|
6
|
-
#
|
7
|
-
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
8
|
-
#
|
9
|
-
class Profiler
|
10
|
-
def self.patch(klass, methods, name) # rubocop:disable Metrics/MethodLength
|
11
|
-
patches = methods.map do |method_name|
|
12
|
-
<<~RUBY
|
13
|
-
unless defined?(#{method_name}__mp_unpatched)
|
14
|
-
alias_method :#{method_name}__mp_unpatched, :#{method_name}
|
15
|
-
def #{method_name}(*args, &blk)
|
16
|
-
unless prof = Thread.current[:_method_profiler]
|
17
|
-
return #{method_name}__mp_unpatched(*args, &blk)
|
18
|
-
end
|
19
|
-
begin
|
20
|
-
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
21
|
-
#{method_name}__mp_unpatched(*args, &blk)
|
22
|
-
ensure
|
23
|
-
data = (prof[:#{name}] ||= {duration: 0.0, calls: 0})
|
24
|
-
data[:duration] += Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
25
|
-
data[:calls] += 1
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
RUBY
|
30
|
-
end.join("\n")
|
31
|
-
|
32
|
-
klass.class_eval patches
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.start
|
36
|
-
Thread.current[:_method_profiler] = {
|
37
|
-
__start: current_timestamp,
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.stop
|
42
|
-
finish = current_timestamp
|
43
|
-
return unless (data = Thread.current[:_method_profiler])
|
44
|
-
|
45
|
-
Thread.current[:_method_profiler] = nil
|
46
|
-
start = data.delete(:__start)
|
47
|
-
data[:total_duration] = finish - start
|
48
|
-
data
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.current_timestamp
|
52
|
-
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|