sidekiq-unique-jobs 6.0.6 → 6.0.25

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.

Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +768 -150
  3. data/README.md +123 -77
  4. data/bin/uniquejobs +2 -2
  5. data/lib/sidekiq-unique-jobs.rb +1 -1
  6. data/lib/sidekiq_unique_jobs/cli.rb +27 -12
  7. data/lib/sidekiq_unique_jobs/client/middleware.rb +8 -4
  8. data/lib/sidekiq_unique_jobs/constants.rb +29 -18
  9. data/lib/sidekiq_unique_jobs/digests.rb +34 -19
  10. data/lib/sidekiq_unique_jobs/job.rb +29 -0
  11. data/lib/sidekiq_unique_jobs/lock/base_lock.rb +14 -18
  12. data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +20 -4
  13. data/lib/sidekiq_unique_jobs/lock/until_executed.rb +7 -3
  14. data/lib/sidekiq_unique_jobs/lock/until_executing.rb +1 -1
  15. data/lib/sidekiq_unique_jobs/lock/until_expired.rb +1 -0
  16. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +9 -3
  17. data/lib/sidekiq_unique_jobs/lock/while_executing_reject.rb +0 -8
  18. data/lib/sidekiq_unique_jobs/locksmith.rb +59 -32
  19. data/lib/sidekiq_unique_jobs/logging.rb +14 -0
  20. data/lib/sidekiq_unique_jobs/middleware.rb +26 -9
  21. data/lib/sidekiq_unique_jobs/normalizer.rb +1 -1
  22. data/lib/sidekiq_unique_jobs/on_conflict/raise.rb +1 -1
  23. data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +3 -3
  24. data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +7 -2
  25. data/lib/sidekiq_unique_jobs/on_conflict/strategy.rb +1 -1
  26. data/lib/sidekiq_unique_jobs/on_conflict.rb +12 -7
  27. data/lib/sidekiq_unique_jobs/options_with_fallback.rb +8 -8
  28. data/lib/sidekiq_unique_jobs/scripts.rb +38 -9
  29. data/lib/sidekiq_unique_jobs/server/middleware.rb +18 -6
  30. data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +1 -1
  31. data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +88 -0
  32. data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +13 -4
  33. data/lib/sidekiq_unique_jobs/testing.rb +3 -3
  34. data/lib/sidekiq_unique_jobs/timeout/calculator.rb +2 -1
  35. data/lib/sidekiq_unique_jobs/timeout.rb +1 -1
  36. data/lib/sidekiq_unique_jobs/unique_args.rb +7 -4
  37. data/lib/sidekiq_unique_jobs/util.rb +8 -4
  38. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  39. data/lib/sidekiq_unique_jobs/version_check.rb +95 -0
  40. data/lib/sidekiq_unique_jobs/web/helpers.rb +7 -6
  41. data/lib/sidekiq_unique_jobs/web/views/unique_digests.erb +4 -0
  42. data/lib/sidekiq_unique_jobs/web.rb +19 -12
  43. data/lib/sidekiq_unique_jobs.rb +33 -107
  44. data/lib/tasks/changelog.rake +23 -0
  45. data/redis/convert_legacy_lock.lua +13 -0
  46. data/redis/delete_by_digest.lua +10 -11
  47. data/redis/delete_job_by_digest.lua +6 -4
  48. data/redis/lock.lua +14 -10
  49. data/redis/unlock.lua +13 -11
  50. metadata +88 -108
  51. data/.codeclimate.yml +0 -35
  52. data/.csslintrc +0 -2
  53. data/.dockerignore +0 -4
  54. data/.editorconfig +0 -14
  55. data/.eslintignore +0 -1
  56. data/.eslintrc +0 -213
  57. data/.fasterer.yml +0 -23
  58. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  59. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  60. data/.gitignore +0 -26
  61. data/.reek.yml +0 -87
  62. data/.rspec +0 -2
  63. data/.rubocop.yml +0 -127
  64. data/.simplecov +0 -20
  65. data/.travis.yml +0 -49
  66. data/.yardopts +0 -7
  67. data/Appraisals +0 -25
  68. data/CODE_OF_CONDUCT.md +0 -74
  69. data/Gemfile +0 -24
  70. data/Guardfile +0 -55
  71. data/Rakefile +0 -12
  72. data/_config.yml +0 -1
  73. data/assets/unique_digests_1.png +0 -0
  74. data/assets/unique_digests_2.png +0 -0
  75. data/bin/bench +0 -20
  76. data/examples/another_unique_job.rb +0 -15
  77. data/examples/custom_queue_job.rb +0 -12
  78. data/examples/custom_queue_job_with_filter_method.rb +0 -13
  79. data/examples/custom_queue_job_with_filter_proc.rb +0 -16
  80. data/examples/expiring_job.rb +0 -12
  81. data/examples/inline_worker.rb +0 -12
  82. data/examples/just_a_worker.rb +0 -13
  83. data/examples/long_running_job.rb +0 -14
  84. data/examples/main_job.rb +0 -14
  85. data/examples/my_job.rb +0 -12
  86. data/examples/my_unique_job.rb +0 -15
  87. data/examples/my_unique_job_with_filter_method.rb +0 -21
  88. data/examples/my_unique_job_with_filter_proc.rb +0 -19
  89. data/examples/notify_worker.rb +0 -14
  90. data/examples/plain_class.rb +0 -13
  91. data/examples/simple_worker.rb +0 -15
  92. data/examples/spawn_simple_worker.rb +0 -12
  93. data/examples/test_class.rb +0 -9
  94. data/examples/unique_across_workers_job.rb +0 -20
  95. data/examples/unique_job_on_conflict_raise.rb +0 -14
  96. data/examples/unique_job_on_conflict_reject.rb +0 -14
  97. data/examples/unique_job_on_conflict_reschedule.rb +0 -14
  98. data/examples/unique_job_with_conditional_parameter.rb +0 -18
  99. data/examples/unique_job_with_filter_method.rb +0 -21
  100. data/examples/unique_job_with_nil_unique_args.rb +0 -20
  101. data/examples/unique_job_with_no_unique_args_method.rb +0 -16
  102. data/examples/unique_job_withthout_unique_args_parameter.rb +0 -18
  103. data/examples/unique_on_all_queues_job.rb +0 -16
  104. data/examples/until_and_while_executing_job.rb +0 -17
  105. data/examples/until_executed_2_job.rb +0 -24
  106. data/examples/until_executed_job.rb +0 -25
  107. data/examples/until_executing_job.rb +0 -11
  108. data/examples/until_expired_job.rb +0 -12
  109. data/examples/until_global_expired_job.rb +0 -12
  110. data/examples/while_executing_job.rb +0 -15
  111. data/examples/while_executing_reject_job.rb +0 -14
  112. data/examples/without_argument_job.rb +0 -13
  113. data/sidekiq-unique-jobs.gemspec +0 -42
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class UntilAndWhileExecutingJob
6
- include Sidekiq::Worker
7
-
8
- sidekiq_options lock: :until_and_while_executing,
9
- lock_expiration: nil,
10
- lock_timeout: 0,
11
- queue: :working
12
-
13
- def perform(sleepy_time)
14
- sleep(sleepy_time)
15
- [sleepy_time]
16
- end
17
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- # This class will lock until the job is successfully executed
6
- #
7
- # It will wait for 0 seconds to acquire a lock and it will expire the unique key after 2 seconds
8
- #
9
- class UntilExecuted2Job
10
- include Sidekiq::Worker
11
- sidekiq_options backtrace: 10,
12
- lock: :until_executed,
13
- lock_timeout: 0,
14
- queue: :working,
15
- retry: 1
16
-
17
- def perform(one, two)
18
- [one, two]
19
- end
20
-
21
- def after_unlock
22
- # NO OP
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- # This class will lock until the job is successfully executed
6
- #
7
- # It will wait for 0 seconds to acquire a lock and it will expire the unique key after 2 seconds
8
- #
9
- class UntilExecutedJob
10
- include Sidekiq::Worker
11
- sidekiq_options backtrace: 10,
12
- lock: :until_executed,
13
- lock_expiration: 5_000,
14
- lock_timeout: 0,
15
- queue: :working,
16
- retry: 1
17
-
18
- def perform(one, two = nil)
19
- [one, two]
20
- end
21
-
22
- def after_unlock
23
- # NO OP
24
- end
25
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class UntilExecutingJob
6
- include Sidekiq::Worker
7
-
8
- sidekiq_options lock: :until_executing, queue: :working
9
-
10
- def perform; end
11
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class UntilExpiredJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_expired, lock_expiration: 1, lock_timeout: 0
8
-
9
- def perform(one)
10
- TestClass.run(one)
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class UntilGlobalExpiredJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_expired
8
-
9
- def perform(arg)
10
- TestClass.run(arg)
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class WhileExecutingJob
6
- include Sidekiq::Worker
7
- sidekiq_options backtrace: 10,
8
- lock: :while_executing,
9
- queue: :working,
10
- retry: 1
11
-
12
- def perform(args)
13
- [args]
14
- end
15
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class WhileExecutingRejectJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :while_executing_reject,
8
- queue: :rejecting
9
-
10
- def perform(args)
11
- sleep 5
12
- p args
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class WithoutArgumentJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_executed,
8
- log_duplicate_payload: true
9
-
10
- def perform
11
- sleep 20
12
- end
13
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path("../lib", __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
-
6
- require 'sidekiq_unique_jobs/version'
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = 'sidekiq-unique-jobs'
10
- spec.version = SidekiqUniqueJobs::VERSION
11
- spec.authors = ['Mikael Henriksson']
12
- spec.email = ['mikael@zoolutions.se']
13
-
14
- spec.summary = 'Uniqueness for Sidekiq Jobs'
15
- spec.description = 'Handles various types of unique jobs for Sidekiq'
16
- spec.homepage = 'https://github.com/mhenrixon/sidekiq-unique-jobs'
17
- spec.license = 'MIT'
18
-
19
- spec.bindir = 'bin'
20
- spec.executables = %w[uniquejobs]
21
-
22
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
- `git ls-files -z`.split("\x0").reject do |file|
24
- file.match(%r{^(test|spec|features|gemfiles|pkg|rails_example|tmp)/})
25
- end
26
- end
27
-
28
- spec.require_paths = ['lib']
29
- spec.add_dependency 'concurrent-ruby', '~> 1.0', '>= 1.0.5'
30
- spec.add_dependency 'sidekiq', '>= 4.0', '< 6.0'
31
- spec.add_dependency 'thor', '~> 0'
32
-
33
- spec.add_development_dependency 'bundler', '~> 1.16'
34
- spec.add_development_dependency 'rspec', '~> 3.7'
35
- spec.add_development_dependency 'rake', '~> 12.3'
36
- spec.add_development_dependency 'timecop', '~> 0.9'
37
- spec.add_development_dependency 'yard', '~> 0.9'
38
- spec.add_development_dependency 'gem-release', '~> 1.0'
39
- spec.add_development_dependency 'awesome_print', '~> 1.8'
40
- spec.add_development_dependency 'rack-test'
41
- spec.add_development_dependency 'sinatra'
42
- end