sidekiq-unique-jobs 4.0.8 → 4.0.9

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/.fasterer.yml +23 -0
  3. data/.rubocop.yml +2 -1
  4. data/CHANGELOG.md +12 -1
  5. data/Gemfile +4 -3
  6. data/README.md +22 -5
  7. data/bin/jobs +6 -0
  8. data/gemfiles/sidekiq_2.15.gemfile +5 -5
  9. data/gemfiles/sidekiq_2.16.gemfile +5 -5
  10. data/gemfiles/sidekiq_2.17.gemfile +3 -2
  11. data/gemfiles/sidekiq_3.0.gemfile +3 -2
  12. data/gemfiles/sidekiq_3.1.gemfile +3 -2
  13. data/gemfiles/sidekiq_3.2.gemfile +3 -2
  14. data/gemfiles/sidekiq_3.3.gemfile +3 -2
  15. data/gemfiles/sidekiq_develop.gemfile +3 -2
  16. data/lib/sidekiq-unique-jobs.rb +13 -8
  17. data/lib/sidekiq/simulator.rb +75 -0
  18. data/lib/sidekiq_unique_jobs/cli.rb +34 -0
  19. data/lib/sidekiq_unique_jobs/lock/until_timeout.rb +5 -2
  20. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +2 -3
  21. data/lib/sidekiq_unique_jobs/middleware.rb +5 -0
  22. data/lib/sidekiq_unique_jobs/scripts.rb +3 -7
  23. data/lib/sidekiq_unique_jobs/util.rb +77 -0
  24. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  25. data/rails_example/.gitignore +13 -0
  26. data/rails_example/Gemfile +20 -0
  27. data/rails_example/Procfile +2 -0
  28. data/rails_example/README.rdoc +28 -0
  29. data/rails_example/Rakefile +6 -0
  30. data/rails_example/app/assets/images/.keep +0 -0
  31. data/rails_example/app/assets/javascripts/application.js +16 -0
  32. data/rails_example/app/assets/stylesheets/application.css +15 -0
  33. data/rails_example/app/controllers/application_controller.rb +5 -0
  34. data/rails_example/app/controllers/concerns/.keep +0 -0
  35. data/rails_example/app/controllers/work_controller.rb +10 -0
  36. data/rails_example/app/helpers/application_helper.rb +2 -0
  37. data/rails_example/app/mailers/.keep +0 -0
  38. data/rails_example/app/models/.keep +0 -0
  39. data/rails_example/app/models/concerns/.keep +0 -0
  40. data/rails_example/app/models/post.rb +2 -0
  41. data/rails_example/app/views/layouts/application.html.erb +15 -0
  42. data/rails_example/app/workers/simple_worker.rb +11 -0
  43. data/rails_example/app/workers/spawn_simple_worker.rb +7 -0
  44. data/rails_example/bin/bundle +3 -0
  45. data/rails_example/bin/rails +4 -0
  46. data/rails_example/bin/rake +4 -0
  47. data/rails_example/bin/setup +29 -0
  48. data/rails_example/config.ru +4 -0
  49. data/rails_example/config/application.rb +26 -0
  50. data/rails_example/config/boot.rb +3 -0
  51. data/rails_example/config/database.yml +26 -0
  52. data/rails_example/config/environment.rb +5 -0
  53. data/rails_example/config/environments/development.rb +41 -0
  54. data/rails_example/config/environments/production.rb +79 -0
  55. data/rails_example/config/environments/test.rb +42 -0
  56. data/rails_example/config/initializers/assets.rb +11 -0
  57. data/rails_example/config/initializers/backtrace_silencers.rb +8 -0
  58. data/rails_example/config/initializers/cookies_serializer.rb +3 -0
  59. data/rails_example/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/rails_example/config/initializers/inflections.rb +16 -0
  61. data/rails_example/config/initializers/mime_types.rb +4 -0
  62. data/rails_example/config/initializers/session_store.rb +3 -0
  63. data/rails_example/config/initializers/sidekiq.rb +13 -0
  64. data/rails_example/config/initializers/wrap_parameters.rb +14 -0
  65. data/rails_example/config/locales/en.yml +23 -0
  66. data/rails_example/config/routes.rb +5 -0
  67. data/rails_example/config/secrets.yml +22 -0
  68. data/rails_example/config/sidekiq.yml +6 -0
  69. data/rails_example/db/development.sqlite3 +0 -0
  70. data/rails_example/db/migrate/20151107231835_create_posts.rb +10 -0
  71. data/rails_example/db/schema.rb +21 -0
  72. data/rails_example/db/seeds.rb +7 -0
  73. data/rails_example/db/test.sqlite3 +0 -0
  74. data/rails_example/lib/assets/.keep +0 -0
  75. data/rails_example/lib/tasks/.keep +0 -0
  76. data/rails_example/log/.keep +0 -0
  77. data/rails_example/public/404.html +67 -0
  78. data/rails_example/public/422.html +67 -0
  79. data/rails_example/public/500.html +66 -0
  80. data/rails_example/public/favicon.ico +0 -0
  81. data/rails_example/public/robots.txt +5 -0
  82. data/rails_example/simple.ru +12 -0
  83. data/rails_example/vendor/assets/javascripts/.keep +0 -0
  84. data/rails_example/vendor/assets/stylesheets/.keep +0 -0
  85. data/sidekiq-unique-jobs.gemspec +4 -2
  86. data/spec/celluloid_with_fallback.rb +9 -8
  87. data/spec/jobs/simple_worker.rb +11 -0
  88. data/spec/jobs/spawn_simple_worker.rb +8 -0
  89. data/spec/lib/sidekiq_unique_jobs/client/middleware_spec.rb +53 -1
  90. data/spec/lib/sidekiq_unique_jobs/lock/until_timeout_spec.rb +26 -0
  91. data/spec/lib/sidekiq_unique_jobs/options_with_fallback_spec.rb +58 -3
  92. data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_jobs_spec.rb +6 -1
  93. data/spec/lib/sidekiq_unique_jobs/unique_args_spec.rb +2 -3
  94. data/spec/lib/sidekiq_unique_jobs/util_spec.rb +53 -0
  95. data/spec/spec_helper.rb +1 -0
  96. metadata +105 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64a81ae8142ce1f78d40061b8c1fbe11cd9ec79a
4
- data.tar.gz: 6fe4d1d19eaa60088d3a7a46ee9761b7de1cfecb
3
+ metadata.gz: 10b0a3b898db3bbf29feae82657b62d4dfa5e248
4
+ data.tar.gz: b3a13fd8edcc4227478a3927bfa7a005d1bac46b
5
5
  SHA512:
6
- metadata.gz: 7b0044b2721c29fa5ffbb342c670c2d8f087719c12e7ad59dc9a30e25b9d9a1ba54bd3cdbbe738202bc4f39a1c27835a1e964837ccdec57fc01c43c2ed0efd6e
7
- data.tar.gz: 2429e2b73e64cbbdb2972278309ca45ecb1dccff56777c65f15dacd05162c59c755d7a55a1c93cbbc71c13bcc4bfdb71a03496dda881842ddc0b5a3205237008
6
+ metadata.gz: e7c316aced14d335b51142a5c1f0270f3231458edac5545dda7e95252209f7d45408140d380f071505e0ffce9314ab82aed697064fc9a1d39eccea5925502333
7
+ data.tar.gz: f8243f502b22d28a56f7a6c102dee27dc460dbd38dd82b53236759dc3a81b577ca95196be4e4de60f6676c358fea323385f8128b2443779fd5c2b85cf8f4d137
@@ -0,0 +1,23 @@
1
+ speedups:
2
+ parallel_assignment: false
3
+ rescue_vs_respond_to: true
4
+ module_eval: true
5
+ shuffle_first_vs_sample: true
6
+ for_loop_vs_each: true
7
+ each_with_index_vs_while: false
8
+ map_flatten_vs_flat_map: true
9
+ reverse_each_vs_reverse_each: true
10
+ select_first_vs_detect: true
11
+ sort_vs_sort_by: true
12
+ fetch_with_argument_vs_block: true
13
+ keys_each_vs_each_key: true
14
+ hash_merge_bang_vs_hash_brackets: true
15
+ block_vs_symbol_to_proc: true
16
+ proc_call_vs_yield: true
17
+ gsub_vs_tr: true
18
+ select_last_vs_reverse_detect: true
19
+ getter_vs_attr_reader: true
20
+ setter_vs_attr_writer: true
21
+
22
+ exclude_paths:
23
+ - 'spec/**/*.rb'
@@ -2,9 +2,10 @@ AllCops:
2
2
  Include:
3
3
  - '**/Rakefile'
4
4
  - '**/lib'
5
+ - '**/bin'
5
6
  - '**/spec'
6
7
  Exclude:
7
- - 'bin/**/*'
8
+ - 'Gemfile.lock'
8
9
  - 'gemfiles/**/*'
9
10
 
10
11
  Lint/HandleExceptions:
@@ -1,6 +1,17 @@
1
+ ## v4.0.9
2
+
3
+ - Add command line and console extensions for removal of unique jobs (c292d87)
4
+
5
+ ## v4.0.8
6
+
7
+ - Use unique arguments for the `WhileExecuting` lock (#127)
8
+ - Delicensed code (#132)
9
+ - Fix queuing unique jobs (#138)
10
+
1
11
  ## v4.0.7
2
12
 
3
13
  - Use unique arguments for the `WhileExecuting` lock (#127)
14
+ - See also https://github.com/mhenrixon/sidekiq-unique-jobs/releases/tag/v4.0.7
4
15
 
5
16
  ## v4.0.6
6
17
 
@@ -47,7 +58,7 @@
47
58
 
48
59
  - Improve uniqueness check performance thanks @mpherham
49
60
  - Remove locks in sidekiq fake testing mode
50
- - Do not unlock jobs when sidekiq is shutting down
61
+ - Do not unlock jobs when sidekiq is shutting down
51
62
 
52
63
  ## v3.0.13
53
64
 
data/Gemfile CHANGED
@@ -2,11 +2,12 @@ source 'http://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'appraisal', '~> 2.0.0'
5
- gem 'rspec-its', require: false
5
+ gem 'rspec-its', require: false
6
+ gem 'rspec-wait', require: false
6
7
 
7
8
  platform :mri_22 do
8
- gem 'pry', require: false
9
- gem 'pry-rescue', require: false
9
+ gem 'fasterer', require: false
10
+ gem 'benchmark-ips', require: false
10
11
  gem 'pry-byebug', require: false
11
12
  gem 'simplecov-json', require: false
12
13
  gem 'memory_profiler', require: false
data/README.md CHANGED
@@ -28,11 +28,11 @@ Or install it yourself as:
28
28
 
29
29
  $ gem install sidekiq-unique-jobs
30
30
 
31
- ## A word on locking
31
+ ## Locking
32
32
 
33
- Like @mperham mentions on [this wiki page](https://github.com/mperham/sidekiq/wiki/Related-Projects#unique-jobs) it is hard to enforce uniqueness with redis in a distributed redis setting.
33
+ Like @mperham mentions on [this wiki page](https://github.com/mperham/sidekiq/wiki/Related-Projects#unique-jobs) it is hard to enforce uniqueness with redis in a distributed redis setting.
34
34
 
35
- To make things worse there are many ways of wanting to enforce uniqueness.
35
+ To make things worse there are many ways of wanting to enforce uniqueness.
36
36
 
37
37
  ### While Executing
38
38
 
@@ -74,7 +74,7 @@ The job won't be unlocked until the timeout/expiry runs out.
74
74
  sidekiq_options unique: :until_and_while_executing
75
75
  ```
76
76
 
77
- This lock is exactly what you would expect. It is considered unique in a way until executing begins and it is locked while executing so what differs from `UntilExecuted`?
77
+ This lock is exactly what you would expect. It is considered unique in a way until executing begins and it is locked while executing so what differs from `UntilExecuted`?
78
78
 
79
79
  The difference is that this job has two types of uniqueness:
80
80
  1. It is unique until execution
@@ -187,7 +187,24 @@ class UniqueJobWithFilterMethod
187
187
  end
188
188
  ```
189
189
 
190
- ### Testing
190
+ ## Debugging
191
+ There are two ways to display and remove keys regarding uniqueness. The console way and the command line way.
192
+
193
+ ### Console
194
+ Start the console with the following command `bundle exec jobs console`.
195
+
196
+ #### List Unique Keys
197
+ `keys '*', count: 100`
198
+
199
+ #### Remove Unique Keys
200
+ `del_by '*', count: 100, dry_run: false` the dry_run and count parameters are both required. This is to have some type of protection against clearing out all uniqueness.
201
+
202
+ ### Command Line
203
+
204
+ `bundle exec jobs` displays help on how to use the unique jobs command line.
205
+
206
+
207
+ ## Testing
191
208
 
192
209
  To enable the testing for `sidekiq-unique-jobs`, add `require 'sidekiq_unique_jobs/testing'` to your testing helper.
193
210
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'sidekiq-unique-jobs'
5
+
6
+ SidekiqUniqueJobs::Cli.start(ARGV)
@@ -1,9 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source 'http://rubygems.org'
4
4
 
5
- gem "appraisal", "~> 1.0.0"
6
- gem "pry", :platform => :mri
7
- gem "sidekiq", "2.15"
5
+ gem 'appraisal', '~> 1.0.0'
6
+ gem 'pry', platform: :mri
7
+ gem 'sidekiq', '2.15'
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: '../'
@@ -1,9 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source 'http://rubygems.org'
4
4
 
5
- gem "appraisal", "~> 1.0.0"
6
- gem "pry", :platform => :mri
7
- gem "sidekiq", "2.16"
5
+ gem 'appraisal', '~> 1.0.0'
6
+ gem 'pry', platform: :mri
7
+ gem 'sidekiq', '2.16'
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: '../'
@@ -4,11 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "appraisal", "~> 2.0.0"
6
6
  gem "rspec-its", :require => false
7
+ gem "rspec-wait", :require => false
7
8
  gem "sidekiq", "~> 2.17.4"
8
9
 
9
10
  platforms :mri_22 do
10
- gem "pry", :require => false
11
- gem "pry-rescue", :require => false
11
+ gem "fasterer", :require => false
12
+ gem "benchmark-ips", :require => false
12
13
  gem "pry-byebug", :require => false
13
14
  gem "simplecov-json", :require => false
14
15
  gem "memory_profiler", :require => false
@@ -4,11 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "appraisal", "~> 2.0.0"
6
6
  gem "rspec-its", :require => false
7
+ gem "rspec-wait", :require => false
7
8
  gem "sidekiq", "~> 3.0.0"
8
9
 
9
10
  platforms :mri_22 do
10
- gem "pry", :require => false
11
- gem "pry-rescue", :require => false
11
+ gem "fasterer", :require => false
12
+ gem "benchmark-ips", :require => false
12
13
  gem "pry-byebug", :require => false
13
14
  gem "simplecov-json", :require => false
14
15
  gem "memory_profiler", :require => false
@@ -4,11 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "appraisal", "~> 2.0.0"
6
6
  gem "rspec-its", :require => false
7
+ gem "rspec-wait", :require => false
7
8
  gem "sidekiq", "~> 3.1.0"
8
9
 
9
10
  platforms :mri_22 do
10
- gem "pry", :require => false
11
- gem "pry-rescue", :require => false
11
+ gem "fasterer", :require => false
12
+ gem "benchmark-ips", :require => false
12
13
  gem "pry-byebug", :require => false
13
14
  gem "simplecov-json", :require => false
14
15
  gem "memory_profiler", :require => false
@@ -4,11 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "appraisal", "~> 2.0.0"
6
6
  gem "rspec-its", :require => false
7
+ gem "rspec-wait", :require => false
7
8
  gem "sidekiq", "~> 3.2.0"
8
9
 
9
10
  platforms :mri_22 do
10
- gem "pry", :require => false
11
- gem "pry-rescue", :require => false
11
+ gem "fasterer", :require => false
12
+ gem "benchmark-ips", :require => false
12
13
  gem "pry-byebug", :require => false
13
14
  gem "simplecov-json", :require => false
14
15
  gem "memory_profiler", :require => false
@@ -4,11 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "appraisal", "~> 2.0.0"
6
6
  gem "rspec-its", :require => false
7
+ gem "rspec-wait", :require => false
7
8
  gem "sidekiq", "~> 3.3.0"
8
9
 
9
10
  platforms :mri_22 do
10
- gem "pry", :require => false
11
- gem "pry-rescue", :require => false
11
+ gem "fasterer", :require => false
12
+ gem "benchmark-ips", :require => false
12
13
  gem "pry-byebug", :require => false
13
14
  gem "simplecov-json", :require => false
14
15
  gem "memory_profiler", :require => false
@@ -4,11 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "appraisal", "~> 2.0.0"
6
6
  gem "rspec-its", :require => false
7
+ gem "rspec-wait", :require => false
7
8
  gem "sidekiq", :github => "mperham/sidekiq"
8
9
 
9
10
  platforms :mri_22 do
10
- gem "pry", :require => false
11
- gem "pry-rescue", :require => false
11
+ gem "fasterer", :require => false
12
+ gem "benchmark-ips", :require => false
12
13
  gem "pry-byebug", :require => false
13
14
  gem "simplecov-json", :require => false
14
15
  gem "memory_profiler", :require => false
@@ -1,5 +1,8 @@
1
1
  require 'yaml' if RUBY_VERSION.include?('2.0.0') # rubocop:disable FileName
2
+ require 'sidekiq_unique_jobs/version'
2
3
  require 'sidekiq_unique_jobs/constants'
4
+ require 'sidekiq_unique_jobs/util'
5
+ require 'sidekiq_unique_jobs/cli'
3
6
  require 'sidekiq_unique_jobs/core_ext'
4
7
  require 'sidekiq_unique_jobs/timeout_calculator'
5
8
  require 'sidekiq_unique_jobs/options_with_fallback'
@@ -8,7 +11,6 @@ require 'sidekiq_unique_jobs/unique_args'
8
11
  require 'sidekiq_unique_jobs/unlockable'
9
12
  require 'sidekiq_unique_jobs/lock'
10
13
  require 'sidekiq_unique_jobs/middleware'
11
- require 'sidekiq_unique_jobs/version'
12
14
  require 'sidekiq_unique_jobs/config'
13
15
  require 'sidekiq_unique_jobs/sidekiq_unique_ext'
14
16
 
@@ -41,7 +43,7 @@ module SidekiqUniqueJobs
41
43
  end
42
44
 
43
45
  def namespace
44
- @namespace ||= Sidekiq.redis { |c| c.respond_to?(:namespace) ? c.namespace : nil }
46
+ @namespace ||= connection { |c| c.respond_to?(:namespace) ? c.namespace : nil }
45
47
  end
46
48
 
47
49
  # Attempt to constantize a string worker_class argument, always
@@ -54,19 +56,22 @@ module SidekiqUniqueJobs
54
56
  end
55
57
 
56
58
  def redis_version
57
- @redis_version ||= Sidekiq.redis { |c| c.info('server')['redis_version'] }
59
+ @redis_version ||= connection { |c| c.info('server')['redis_version'] }
58
60
  end
59
61
 
60
- def connection(redis_pool = nil, &block)
61
- return mock_redis if config.mocking?
62
- redis_pool ? redis_pool.with(&block) : Sidekiq.redis(&block)
62
+ def connection(redis_pool = nil)
63
+ if redis_pool
64
+ redis_pool.with { |conn| yield conn }
65
+ else
66
+ Sidekiq.redis { |conn| yield conn }
67
+ end
63
68
  end
64
69
 
65
70
  def mock_redis
66
71
  @redis_mock ||= MockRedis.new if defined?(MockRedis)
67
72
  end
68
73
 
69
- def synchronize(item, redis_pool, &blk)
70
- Lock::WhileExecuting.synchronize(item, redis_pool, &blk)
74
+ def synchronize(item, redis_pool)
75
+ Lock::WhileExecuting.synchronize(item, redis_pool) { yield }
71
76
  end
72
77
  end
@@ -0,0 +1,75 @@
1
+ require 'sidekiq/launcher'
2
+ require 'timeout'
3
+
4
+ module Sidekiq
5
+ class Simulator
6
+ attr_reader :queues, :launcher
7
+
8
+ def self.process_queue(queue)
9
+ new(queue).process_queue { yield }
10
+ end
11
+
12
+ def initialize(queue)
13
+ @queues = [queue].flatten.uniq
14
+ @launcher = Sidekiq::Launcher.new(sidekiq_options(queues))
15
+ end
16
+
17
+ def process_queue
18
+ run_launcher { yield }
19
+ ensure
20
+ terminate_launcher
21
+ end
22
+
23
+ private
24
+
25
+ def run_launcher
26
+ using_timeout(15) do
27
+ launcher.run
28
+ sleep 0.001 until alive?
29
+ end
30
+ rescue Timeout::Error => e
31
+ logger.warn { "Timeout while running #{__method__}" }
32
+ logger.warn { e }
33
+ ensure
34
+ yield
35
+ end
36
+
37
+ def terminate_launcher
38
+ if launcher.respond_to?(:alive?)
39
+ launcher.terminate # Better to be fast than graceful for our purposes
40
+ else
41
+ launcher.stop # New sidekiq works better
42
+ end
43
+ end
44
+
45
+ def alive?
46
+ if launcher.respond_to?(:alive?)
47
+ launcher.alive?
48
+ else
49
+ launcher.manager.workers.size > 0
50
+ end
51
+ end
52
+
53
+ def stopped?
54
+ !alive?
55
+ end
56
+
57
+ def using_timeout(value)
58
+ Timeout.timeout(value) do
59
+ yield
60
+ end
61
+ end
62
+
63
+ def sidekiq_options(queues = [])
64
+ { queues: queues,
65
+ concurrency: 3,
66
+ timeout: 3,
67
+ verbose: false,
68
+ logfile: './tmp/sidekiq.log' }
69
+ end
70
+
71
+ def logger
72
+ @logger ||= Sidekiq.logger
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,34 @@
1
+ require 'thor'
2
+
3
+ module SidekiqUniqueJobs
4
+ class Cli < Thor
5
+ desc 'keys PATTERN', 'list all unique keys and their expiry time'
6
+ option :count, aliases: :c, type: :numeric, default: 1000, desc: 'The max number of keys to return'
7
+ def keys(pattern)
8
+ Util.keys(pattern, count: options[:count])
9
+ end
10
+
11
+ desc 'del_by PATTERN', 'deletes unique keys from redis by pattern'
12
+ option :dry_run, aliases: :d, type: :boolean, desc: 'set to false to perform deletion'
13
+ option :count, aliases: :c, type: :numeric, default: 1000, desc: 'The max number of keys to return'
14
+ def del_by(pattern)
15
+ Util.del_by(pattern, dry_run: dry_run, count: count)
16
+ end
17
+
18
+ desc 'drop into a console', 'easy access to helper methods'
19
+ def console
20
+ puts "Use `keys '*', count: 1000 to display the first 1000 unique keys matching '*'"
21
+ puts "Use `del '*', count: 1000 to see how many keys would be deleted for the pattern '*'"
22
+ puts "Use `del '*', dry_run: false, count: 1000 to delete the first 1000 keys matching '*'"
23
+ begin
24
+ require 'pry'
25
+ Object.include SidekiqUniqueJobs::Util
26
+ Pry.start
27
+ rescue LoadError
28
+ require 'irb'
29
+ Object.include SidekiqUniqueJobs::Util
30
+ IRB.start
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,8 +2,11 @@ module SidekiqUniqueJobs
2
2
  module Lock
3
3
  class UntilTimeout < UntilExecuted
4
4
  def unlock(scope)
5
- return true if scope.to_sym == :server
6
- fail ArgumentError, "#{scope} middleware can't #{__method__} #{unique_key}"
5
+ if scope.to_sym == :server
6
+ return true
7
+ else
8
+ fail ArgumentError, "#{scope} middleware can't #{__method__} #{unique_key}"
9
+ end
7
10
  end
8
11
 
9
12
  def execute(_callback)