sidekiq-unique-jobs 7.0.0.beta27 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sidekiq-unique-jobs might be problematic. Click here for more details.

Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -14
  3. data/README.md +162 -30
  4. data/lib/sidekiq-unique-jobs.rb +0 -2
  5. data/lib/sidekiq_unique_jobs.rb +1 -0
  6. data/lib/sidekiq_unique_jobs/batch_delete.rb +1 -1
  7. data/lib/sidekiq_unique_jobs/changelog.rb +11 -4
  8. data/lib/sidekiq_unique_jobs/config.rb +2 -2
  9. data/lib/sidekiq_unique_jobs/constants.rb +2 -0
  10. data/lib/sidekiq_unique_jobs/digests.rb +1 -1
  11. data/lib/sidekiq_unique_jobs/job.rb +1 -1
  12. data/lib/sidekiq_unique_jobs/json.rb +7 -1
  13. data/lib/sidekiq_unique_jobs/lock.rb +31 -1
  14. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +1 -1
  15. data/lib/sidekiq_unique_jobs/lock_config.rb +2 -0
  16. data/lib/sidekiq_unique_jobs/locksmith.rb +1 -1
  17. data/lib/sidekiq_unique_jobs/lua/lock.lua +10 -11
  18. data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +8 -7
  19. data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +9 -2
  20. data/lib/sidekiq_unique_jobs/middleware.rb +0 -57
  21. data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +9 -8
  22. data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +1 -1
  23. data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
  24. data/lib/sidekiq_unique_jobs/orphans/reaper.rb +10 -0
  25. data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +14 -5
  26. data/lib/sidekiq_unique_jobs/redis/entity.rb +9 -3
  27. data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +27 -0
  28. data/lib/sidekiq_unique_jobs/server.rb +48 -0
  29. data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +1 -1
  30. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  31. data/lib/sidekiq_unique_jobs/web.rb +26 -9
  32. data/lib/sidekiq_unique_jobs/web/helpers.rb +24 -3
  33. data/lib/sidekiq_unique_jobs/web/views/changelogs.erb +54 -0
  34. data/lib/sidekiq_unique_jobs/web/views/locks.erb +1 -1
  35. metadata +12 -8
  36. 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