sidekiq-unique-jobs 4.0.0 → 4.0.7

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +1 -1
  3. data/.travis.yml +1 -2
  4. data/Appraisals +1 -1
  5. data/CHANGELOG.md +44 -1
  6. data/Gemfile +1 -2
  7. data/README.md +49 -51
  8. data/circle.yml +3 -1
  9. data/gemfiles/sidekiq_2.17.gemfile +7 -5
  10. data/gemfiles/sidekiq_3.0.gemfile +6 -4
  11. data/gemfiles/sidekiq_3.1.gemfile +6 -4
  12. data/gemfiles/sidekiq_3.2.gemfile +6 -4
  13. data/gemfiles/sidekiq_3.3.gemfile +6 -4
  14. data/gemfiles/sidekiq_develop.gemfile +6 -4
  15. data/lib/sidekiq-unique-jobs.rb +3 -6
  16. data/lib/sidekiq_unique_jobs/config.rb +1 -6
  17. data/lib/sidekiq_unique_jobs/constants.rb +17 -0
  18. data/lib/sidekiq_unique_jobs/core_ext.rb +28 -23
  19. data/lib/sidekiq_unique_jobs/lock.rb +1 -1
  20. data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +13 -0
  21. data/lib/sidekiq_unique_jobs/lock/until_executed.rb +17 -3
  22. data/lib/sidekiq_unique_jobs/lock/until_executing.rb +4 -0
  23. data/lib/sidekiq_unique_jobs/lock/until_timeout.rb +9 -2
  24. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +17 -5
  25. data/lib/sidekiq_unique_jobs/options_with_fallback.rb +14 -5
  26. data/lib/sidekiq_unique_jobs/server/middleware.rb +3 -40
  27. data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +29 -2
  28. data/lib/sidekiq_unique_jobs/testing/sidekiq_overrides.rb +6 -2
  29. data/lib/sidekiq_unique_jobs/timeout_calculator.rb +42 -0
  30. data/lib/sidekiq_unique_jobs/unique_args.rb +31 -29
  31. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  32. data/redis/synchronize.lua +1 -1
  33. data/sidekiq-unique-jobs.gemspec +1 -2
  34. data/spec/{workers/unique_worker.rb → jobs/another_unique_job.rb} +3 -3
  35. data/spec/{workers/queue_worker.rb → jobs/custom_queue_job.rb} +1 -1
  36. data/spec/jobs/custom_queue_job_with_filter_method.rb +7 -0
  37. data/spec/{workers/queue_worker_with_filter_proc.rb → jobs/custom_queue_job_with_filter_proc.rb} +2 -3
  38. data/spec/jobs/expiring_job.rb +4 -0
  39. data/spec/{workers → jobs}/inline_worker.rb +1 -1
  40. data/spec/jobs/just_a_worker.rb +8 -0
  41. data/spec/jobs/main_job.rb +8 -0
  42. data/spec/{workers/my_worker.rb → jobs/my_job.rb} +2 -3
  43. data/spec/jobs/my_unique_job.rb +7 -0
  44. data/spec/{workers → jobs}/plain_class.rb +0 -0
  45. data/spec/{workers → jobs}/test_class.rb +0 -0
  46. data/spec/{workers → jobs}/unique_job_with_filter_method.rb +2 -2
  47. data/spec/{workers/unique_on_all_queues_worker.rb → jobs/unique_on_all_queues_job.rb} +3 -3
  48. data/spec/jobs/until_and_while_executing_job.rb +8 -0
  49. data/spec/{workers/another_unique_worker.rb → jobs/until_executed_job.rb} +6 -2
  50. data/spec/jobs/until_executing_job.rb +8 -0
  51. data/spec/jobs/until_global_timeout_job.rb +8 -0
  52. data/spec/{workers/inline_expiration_worker.rb → jobs/until_timeout_job.rb} +2 -2
  53. data/spec/{workers/after_unlock_worker.rb → jobs/while_executing_job.rb} +2 -3
  54. data/spec/lib/sidekiq_unique_jobs/client/middleware_spec.rb +60 -44
  55. data/spec/lib/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb +39 -0
  56. data/spec/lib/sidekiq_unique_jobs/lock/until_executed_spec.rb +40 -0
  57. data/spec/lib/sidekiq_unique_jobs/lock/while_executing_spec.rb +15 -4
  58. data/spec/lib/sidekiq_unique_jobs/options_with_fallback_spec.rb +25 -0
  59. data/spec/lib/sidekiq_unique_jobs/scripts_spec.rb +3 -4
  60. data/spec/lib/sidekiq_unique_jobs/server/middleware_spec.rb +51 -68
  61. data/spec/lib/sidekiq_unique_jobs/sidekiq_testing_enabled_spec.rb +75 -79
  62. data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_ext_spec.rb +2 -2
  63. data/spec/lib/sidekiq_unique_jobs/{lock/time_calculator_spec.rb → timeout_calculator_spec.rb} +10 -11
  64. data/spec/lib/sidekiq_unique_jobs/unique_args_spec.rb +28 -45
  65. data/spec/spec_helper.rb +23 -15
  66. data/spec/support/unique_macros.rb +20 -1
  67. metadata +30 -42
  68. data/lib/sidekiq_unique_jobs/lock/time_calculator.rb +0 -44
  69. data/spec/workers/after_yield_worker.rb +0 -17
  70. data/spec/workers/before_yield_worker.rb +0 -9
  71. data/spec/workers/expiring_worker.rb +0 -4
  72. data/spec/workers/inline_unlock_order_worker.rb +0 -8
  73. data/spec/workers/just_a_worker.rb +0 -8
  74. data/spec/workers/main_job.rb +0 -8
  75. data/spec/workers/my_unique_worker.rb +0 -8
  76. data/spec/workers/queue_worker_with_filter_method.rb +0 -7
  77. data/spec/workers/run_lock_with_retries_worker.rb +0 -12
  78. data/spec/workers/run_lock_worker.rb +0 -7
  79. data/spec/workers/while_executing_worker.rb +0 -13
@@ -1,17 +0,0 @@
1
- class AfterYieldWorker
2
- include Sidekiq::Worker
3
- sidekiq_options queue: :unlock_ordering, retry: 1, backtrace: 10
4
- sidekiq_options unique: true, unique_lock: :until_executed
5
-
6
- sidekiq_retries_exhausted do |msg|
7
- Sidekiq.logger.warn "Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}"
8
- end
9
-
10
- def perform(*)
11
- # NO-OP
12
- end
13
-
14
- def after_unlock
15
- fail 'HELL'
16
- end
17
- end
@@ -1,9 +0,0 @@
1
- class BeforeYieldWorker
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options queue: :unlock_ordering
5
- sidekiq_options unique: true, unique_lock: :until_executing
6
-
7
- def perform
8
- end
9
- end
@@ -1,4 +0,0 @@
1
- class ExpiringWorker
2
- include Sidekiq::Worker
3
- sidekiq_options unique: true, unique_expiration: 10 * 60, unique_lock: :until_executed
4
- end
@@ -1,8 +0,0 @@
1
- class InlineUnlockOrderWorker
2
- include Sidekiq::Worker
3
- sidekiq_options unique: true, unique_lock: :until_timeout
4
-
5
- def perform(x)
6
- TestClass.run(x)
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- class JustAWorker
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options unique: true, queue: 'testqueue', unique_lock: :until_executed
5
-
6
- def perform
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- class MainJob
2
- include Sidekiq::Worker
3
- sidekiq_options queue: :customqueue, unique: true, unique_lock: :until_executed
4
- sidekiq_options log_duplicate_payload: true
5
-
6
- def perform(_)
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- class MyUniqueWorker
2
- include Sidekiq::Worker
3
- sidekiq_options queue: :customqueue, retry: true, unique: true,
4
- unique_expiration: 7_200, retry_count: 10,
5
- unique_lock: :until_executed
6
- def perform(_)
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- class QueueWorkerWithFilterMethod < QueueWorker
2
- sidekiq_options unique: true, unique_args: :args_filter, unique_lock: :until_executed
3
-
4
- def self.args_filter(*args)
5
- args.first
6
- end
7
- end
@@ -1,12 +0,0 @@
1
- class RunLockWithRetriesWorker
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options unique: true,
5
- unique_locks: :while_executing,
6
- queue: :unlock_ordering,
7
- run_lock_retries: 10,
8
- run_lock_retry_interval: 0,
9
- reschedule_on_lock_fail: true
10
- def perform
11
- end
12
- end
@@ -1,7 +0,0 @@
1
- class RunLockWorker
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options unique: true, unique_locks: :while_executing, queue: :unlock_ordering
5
- def perform
6
- end
7
- end
@@ -1,13 +0,0 @@
1
- class WhileExecutingWorker
2
- include Sidekiq::Worker
3
- sidekiq_options queue: :working, retry: 1, backtrace: 10
4
- sidekiq_options unique: true, unique_lock: :while_executing
5
-
6
- sidekiq_retries_exhausted do |msg|
7
- Sidekiq.logger.warn "Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}"
8
- end
9
-
10
- def perform(_)
11
- fail 'HELL'
12
- end
13
- end