sidekiq-unique-jobs 6.0.13 → 6.0.16

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/sidekiq_unique_jobs.rb +1 -0
  4. data/lib/sidekiq_unique_jobs/cli.rb +3 -1
  5. data/lib/sidekiq_unique_jobs/constants.rb +1 -0
  6. data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +20 -4
  7. data/lib/sidekiq_unique_jobs/locksmith.rb +2 -2
  8. data/lib/sidekiq_unique_jobs/logging.rb +5 -0
  9. data/lib/sidekiq_unique_jobs/middleware.rb +1 -1
  10. data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +7 -3
  11. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  12. data/lib/sidekiq_unique_jobs/version_check.rb +95 -0
  13. data/lib/sidekiq_unique_jobs/web.rb +4 -4
  14. data/lib/sidekiq_unique_jobs/web/helpers.rb +4 -4
  15. metadata +32 -74
  16. data/.codeclimate.yml +0 -32
  17. data/.editorconfig +0 -14
  18. data/.fasterer.yml +0 -23
  19. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  20. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  21. data/.gitignore +0 -17
  22. data/.mdlrc +0 -1
  23. data/.reek.yml +0 -88
  24. data/.rspec +0 -2
  25. data/.rubocop.yml +0 -159
  26. data/.simplecov +0 -20
  27. data/.travis.yml +0 -57
  28. data/.yardopts +0 -1
  29. data/Appraisals +0 -33
  30. data/CODE_OF_CONDUCT.md +0 -74
  31. data/Gemfile +0 -29
  32. data/Guardfile +0 -26
  33. data/Rakefile +0 -29
  34. data/_config.yml +0 -1
  35. data/assets/unique_digests_1.png +0 -0
  36. data/assets/unique_digests_2.png +0 -0
  37. data/bin/bench +0 -36
  38. data/examples/another_unique_job.rb +0 -15
  39. data/examples/custom_queue_job.rb +0 -12
  40. data/examples/custom_queue_job_with_filter_method.rb +0 -13
  41. data/examples/custom_queue_job_with_filter_proc.rb +0 -16
  42. data/examples/expiring_job.rb +0 -12
  43. data/examples/inline_worker.rb +0 -12
  44. data/examples/just_a_worker.rb +0 -13
  45. data/examples/long_running_job.rb +0 -14
  46. data/examples/main_job.rb +0 -14
  47. data/examples/my_job.rb +0 -12
  48. data/examples/my_unique_job.rb +0 -15
  49. data/examples/my_unique_job_with_filter_method.rb +0 -21
  50. data/examples/my_unique_job_with_filter_proc.rb +0 -19
  51. data/examples/notify_worker.rb +0 -14
  52. data/examples/plain_class.rb +0 -13
  53. data/examples/simple_worker.rb +0 -15
  54. data/examples/spawn_simple_worker.rb +0 -12
  55. data/examples/test_class.rb +0 -9
  56. data/examples/unique_across_workers_job.rb +0 -20
  57. data/examples/unique_job_on_conflict_raise.rb +0 -14
  58. data/examples/unique_job_on_conflict_reject.rb +0 -14
  59. data/examples/unique_job_on_conflict_reschedule.rb +0 -14
  60. data/examples/unique_job_with_conditional_parameter.rb +0 -18
  61. data/examples/unique_job_with_filter_method.rb +0 -21
  62. data/examples/unique_job_with_nil_unique_args.rb +0 -20
  63. data/examples/unique_job_with_no_unique_args_method.rb +0 -16
  64. data/examples/unique_job_withthout_unique_args_parameter.rb +0 -18
  65. data/examples/unique_on_all_queues_job.rb +0 -16
  66. data/examples/until_and_while_executing_job.rb +0 -17
  67. data/examples/until_executed_2_job.rb +0 -24
  68. data/examples/until_executed_job.rb +0 -25
  69. data/examples/until_executing_job.rb +0 -11
  70. data/examples/until_expired_job.rb +0 -12
  71. data/examples/until_global_expired_job.rb +0 -12
  72. data/examples/while_executing_job.rb +0 -15
  73. data/examples/while_executing_reject_job.rb +0 -14
  74. data/examples/without_argument_job.rb +0 -13
  75. data/sidekiq-unique-jobs.gemspec +0 -63
  76. data/update_docs.sh +0 -37
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- --no-private --markup-provider=redcarpet --markup=markdown lib/**/*.rb - README.md
data/Appraisals DELETED
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise 'sidekiq-develop' do
4
- gem 'sidekiq', git: 'https://github.com/mperham/sidekiq.git'
5
- end
6
-
7
- appraise 'sidekiq-4.0' do
8
- gem 'sidekiq', '~> 4.0.0'
9
- end
10
-
11
- appraise 'sidekiq-4.1' do
12
- gem 'sidekiq', '~> 4.1.0'
13
- end
14
-
15
- appraise 'sidekiq-4.2' do
16
- gem 'sidekiq', '~> 4.2.0'
17
- end
18
-
19
- appraise 'sidekiq-5.0' do
20
- gem 'sidekiq', '~> 5.0.0'
21
- end
22
-
23
- appraise 'sidekiq-5.1' do
24
- gem 'sidekiq', '~> 5.1.0'
25
- end
26
-
27
- appraise 'sidekiq-5.2' do
28
- gem 'sidekiq', '~> 5.2.0'
29
- end
30
-
31
- appraise 'sidekiq-6.0' do
32
- gem 'sidekiq', git: 'https://github.com/mperham/sidekiq.git', branch: '6-0'
33
- end
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at mikael@zoolutions.se. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
- gemspec
5
-
6
- gem "appraisal", "~> 2.2.0"
7
- gem "rspec-eventually", require: false
8
- gem "rspec-its", require: false
9
- gem "rspec-retry", require: false
10
- gem "sidekiq", git: "https://github.com/mperham/sidekiq.git", branch: "6-0"
11
-
12
- platforms :mri_25 do
13
- gem "benchmark-ips"
14
- gem "fasterer"
15
- gem "fuubar"
16
- gem "guard"
17
- gem "guard-reek"
18
- gem "guard-rspec"
19
- gem "guard-rubocop"
20
- gem "memory_profiler"
21
- gem "pry"
22
- gem "redcarpet", "~> 3.4"
23
- gem "reek", ">= 5.3"
24
- gem "rubocop"
25
- gem "rubocop-performance"
26
- gem "rubocop-rspec"
27
- gem "simplecov-json"
28
- gem "travis"
29
- end
data/Guardfile DELETED
@@ -1,26 +0,0 @@
1
- guard :rspec, cmd: "env COV=false bundle exec rspec" do
2
- require "guard/rspec/dsl"
3
- dsl = Guard::RSpec::Dsl.new(self)
4
-
5
- # RSpec files
6
- rspec = dsl.rspec
7
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
8
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/integration/#{m[1]}_spec.rb" }
9
- watch(%r{^examples/(.+)\.rb$}) { |m| "spec/examples/#{m[1]}_spec.rb" }
10
- watch(rspec.spec_helper) { rspec.spec_dir }
11
- watch(rspec.spec_support) { rspec.spec_dir }
12
- watch(rspec.spec_files)
13
-
14
- ruby = dsl.ruby
15
- dsl.watch_spec_files_for(ruby.lib_files)
16
- end
17
-
18
- guard :rubocop do
19
- watch(%r{.+\.rb$})
20
- watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
21
- end
22
-
23
- guard 'reek' do
24
- watch(%r{.+\.rb$})
25
- watch('.reek')
26
- end
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rspec/core/rake_task"
4
- require "rubocop/rake_task"
5
-
6
- Dir.glob("#{File.expand_path(__dir__)}/lib/tasks/**/*.rake").each { |f| import f }
7
-
8
- RuboCop::RakeTask.new(:style)
9
- RSpec::Core::RakeTask.new(:spec)
10
-
11
- require "yard"
12
- YARD::Rake::YardocTask.new do |t|
13
- t.files = %w[lib/sidekiq_unique_jobs/**/*.rb"]
14
- t.options = %w[
15
- --no-private
16
- --markup=markdown
17
- --markup-provider=redcarpet
18
- --readme README.md
19
- ]
20
- end
21
-
22
- task default: [:style, :spec]
23
-
24
- task :release do
25
- sh("./update_docs.sh")
26
- sh("gem release --tag --push")
27
- Rake::Task["changelog"].invoke
28
- sh("gem bump --file lib/sidekiq_unique_jobs/version.rb")
29
- end
@@ -1 +0,0 @@
1
- theme: jekyll-theme-merlot
Binary file
Binary file
data/bin/bench DELETED
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Trap interrupts to quit cleanly. See
5
- # https://twitter.com/mitchellh/status/283014103189053442
6
- Signal.trap("INT") { abort }
7
-
8
- require "bundler/setup"
9
- require "benchmark/ips"
10
- require "sidekiq-unique-jobs"
11
-
12
- ITERATIONS ||= 10_000
13
- LOCK_TYPES = %w[
14
- until_executed
15
- until_expired
16
- until_and_while_executing
17
- until_executing
18
- while_executing
19
- ].freeze
20
-
21
- Benchmark.ips do |x|
22
- x.config(time: 180, warmup: 2)
23
- x.report("locksmith lock and unlock") do |_times|
24
- item = {
25
- "ttl" => rand(10),
26
- "jid" => SecureRandom.hex,
27
- "unique_digest" => SecureRandom.hex,
28
- "lock" => LOCK_TYPES.sample,
29
- }
30
- locksmith = SidekiqUniqueJobs::Locksmith.new(item)
31
- locksmith.lock
32
- locksmith.unlock
33
- end
34
-
35
- x.compare!
36
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class AnotherUniqueJob
6
- include Sidekiq::Worker
7
- sidekiq_options backtrace: 10,
8
- lock: :until_executed,
9
- queue: :working2,
10
- retry: 1
11
-
12
- def perform(args)
13
- args
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class CustomQueueJob
6
- include Sidekiq::Worker
7
- sidekiq_options queue: :customqueue
8
-
9
- def perform(one, two = "two")
10
- [one, two]
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- require_relative "custom_queue_job"
6
-
7
- class CustomQueueJobWithFilterMethod < CustomQueueJob
8
- sidekiq_options lock: :until_executed, unique_args: :args_filter
9
-
10
- def self.args_filter(args)
11
- args.first
12
- end
13
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- require_relative "./custom_queue_job"
6
-
7
- class CustomQueueJobWithFilterProc < CustomQueueJob
8
- # slightly contrived example of munging args to the
9
- # worker and removing a random bit.
10
- sidekiq_options lock: :until_expired,
11
- unique_args: (lambda do |args|
12
- options = args.extract_options!
13
- options.delete("random")
14
- args + [options]
15
- end)
16
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class ExpiringJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_executed, lock_expiration: 10 * 60
8
-
9
- def perform(one, two)
10
- [one, two]
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class InlineWorker
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :while_executing, lock_timeout: 5
8
-
9
- def perform(one)
10
- TestClass.run(one)
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class JustAWorker
6
- include Sidekiq::Worker
7
-
8
- sidekiq_options lock: :until_executed, queue: :testqueue
9
-
10
- def perform(options = {})
11
- options
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class LongRunningJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_and_while_executing,
8
- lock_expiration: 7_200,
9
- queue: :customqueue,
10
- retry: 10
11
- def perform(one, two)
12
- [one, two]
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class MainJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_executed,
8
- log_duplicate_payload: true,
9
- queue: :customqueue
10
-
11
- def perform(arg)
12
- [arg]
13
- end
14
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class MyJob
6
- include Sidekiq::Worker
7
- sidekiq_options queue: :working, retry: 1, backtrace: 10
8
-
9
- def perform(one)
10
- [one]
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class MyUniqueJob
6
- include Sidekiq::Worker
7
- sidekiq_options lock: :until_executed,
8
- lock_expiration: 7_200,
9
- queue: :customqueue,
10
- retry: 10
11
-
12
- def perform(one, two)
13
- [one, two]
14
- end
15
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class MyUniqueJobWithFilterMethod
6
- include Sidekiq::Worker
7
- sidekiq_options backtrace: true,
8
- lock: :until_executed,
9
- queue: :customqueue,
10
- retry: true,
11
- unique_args: :filtered_args
12
-
13
- def perform(*)
14
- # NO-OP
15
- end
16
-
17
- def self.filtered_args(args)
18
- options = args.extract_options!
19
- [args.first, options["type"]]
20
- end
21
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- class MyUniqueJobWithFilterProc
6
- include Sidekiq::Worker
7
- sidekiq_options backtrace: true,
8
- lock: :until_executed,
9
- queue: :customqueue,
10
- retry: true,
11
- unique_args: (lambda do |args|
12
- options = args.extract_options!
13
- [args.first, options["type"]]
14
- end)
15
-
16
- def perform(*)
17
- # NO-OP
18
- end
19
- end