sidekiq-unique-jobs 5.0.10 → 5.0.11

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 53332a20911a2add535139974709245c03425d86
4
- data.tar.gz: f9b4bd20a09320b593f5e6d30ad7c10b1e8868de
2
+ SHA256:
3
+ metadata.gz: 87c40a03b7114fd7c5b1c56ceaaf8f4d96b19939bd06f0b76e0c3ce088e34ee1
4
+ data.tar.gz: 7b41fc69c8cd77117a56beb1d15a17b523f4bff7a742317735cfcc28cda121de
5
5
  SHA512:
6
- metadata.gz: b2164f8cd400bb144f5f6fd562177703ef935d55b9310d38dd94a29fd4e514748fdb50e57a5d690f2803c7a58392c534bf5900277af675764242435e53453e82
7
- data.tar.gz: 71368b0d324404d60a1ebfc217dc417e7a70e233da312005184030089361c8f9755032f42f256bde1e31c4d6f5a1ec3873e4120af961cb0da1179bf81bc3a882
6
+ metadata.gz: 78dbf85901350c5b9e9e10889b25de771ef1c9757ac1e9a3565bc7b447501d0505770a3e9befda2242f855319c373777fee01e9c92c37bf1facdbeac87cb052e
7
+ data.tar.gz: ae243b12f6a0b4db056f474584e53017076226a93e87cc9fd45f7525f7e4a0e44da076a5725895405a3f6db6588578664cd0bc3fba746f139bb0ff65aba8f565
data/.gitignore CHANGED
@@ -16,3 +16,9 @@ rails_example/spec/examples.txt
16
16
  *.sublime-*
17
17
 
18
18
  /sidekiq/
19
+
20
+ /spec/examples.txt
21
+
22
+ /gemfiles/.bundle/
23
+
24
+ /.rspec_status
@@ -1,13 +1,13 @@
1
1
  AllCops:
2
2
  Include:
3
3
  - '**/Rakefile'
4
- - '**/lib'
5
- - '**/bin'
6
- - '**/spec'
4
+ - 'lib/**/*.rb'
5
+ - 'bin/**/*.rb'
6
+ - 'spec/**/*.rb'
7
7
  Exclude:
8
8
  - 'Gemfile.lock'
9
9
  - 'gemfiles/**/*'
10
- TargetRubyVersion: 2.4
10
+ TargetRubyVersion: 2.5
11
11
 
12
12
  Lint/HandleExceptions:
13
13
  Enabled: true
@@ -35,19 +35,13 @@ Metrics/BlockLength:
35
35
  Metrics/PerceivedComplexity:
36
36
  Max: 8
37
37
 
38
- Style/AccessorMethodName:
38
+ Naming/AccessorMethodName:
39
39
  Enabled: true
40
40
 
41
- Style/ConstantName:
41
+ Naming/ConstantName:
42
42
  Enabled: true
43
43
 
44
- Style/FrozenStringLiteralComment:
45
- Enabled: true
46
-
47
- Style/Documentation:
48
- Enabled: false
49
-
50
- Style/FileName:
44
+ Naming/FileName:
51
45
  Enabled: true
52
46
  Exclude:
53
47
  - 'lib/sidekiq-unique-jobs.rb'
@@ -55,6 +49,12 @@ Style/FileName:
55
49
  - '**/Appraisals'
56
50
  - '**/*.gemspec'
57
51
 
52
+ Style/FrozenStringLiteralComment:
53
+ Enabled: true
54
+
55
+ Style/Documentation:
56
+ Enabled: false
57
+
58
58
  Style/GlobalVars:
59
59
  Enabled: true
60
60
 
@@ -80,6 +80,10 @@ Style/TrailingCommaInArguments:
80
80
  Enabled: true
81
81
  EnforcedStyleForMultiline: comma
82
82
 
83
- Style/TrailingCommaInLiteral:
83
+ Style/TrailingCommaInArrayLiteral:
84
+ Enabled: true
85
+ EnforcedStyleForMultiline: comma
86
+
87
+ Style/TrailingCommaInHashLiteral:
84
88
  Enabled: true
85
89
  EnforcedStyleForMultiline: comma
data/.simplecov CHANGED
@@ -2,7 +2,7 @@ require 'simplecov-json'
2
2
  require 'codeclimate-test-reporter'
3
3
 
4
4
  SimpleCov.command_name 'rspec'
5
- SimpleCov.refuse_coverage_drop
5
+ # SimpleCov.refuse_coverage_drop
6
6
  SimpleCov.formatters = [
7
7
  SimpleCov::Formatter::HTMLFormatter,
8
8
  SimpleCov::Formatter::JSONFormatter,
@@ -1,38 +1,48 @@
1
- sudo: false
1
+ env:
2
+ matrix:
3
+ - COV=false
4
+ global:
5
+ - CC_TEST_REPORTER_ID=88e524e8f638efe690def7a6e2c72b1a9db5cdfa74548921b734d609a5858ee5
6
+ - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
7
+ dist: trusty
8
+ sudo: required
2
9
  language: ruby
3
10
  cache: bundler
4
- # before_install:
5
- # - rvm get head
6
- # - gem update --system
7
- # - gem install bundler
8
11
  services:
9
12
  - redis-server
13
+
14
+ before_install:
15
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
16
+ - chmod +x ./cc-test-reporter
17
+ before_script:
18
+ - ./cc-test-reporter before-build
10
19
  script:
11
- - if [[ "${STYLE}" = "true" ]]; then bundle exec rubocop - P; fi;
12
- - bundle exec rspec spec
13
- - if [[ "${STYLE}" = "true" ]]; then CODECLIMATE_REPO_TOKEN=88e524e8f638efe690def7a6e2c72b1a9db5cdfa74548921b734d609a5858ee5 bundle exec codeclimate-test-reporter; fi;
20
+ - if [[ "${COV}" = "true" ]]; then bundle exec rubocop -P; fi;
21
+ - bundle exec rspec
22
+ after_script:
23
+ - if [[ "${COV}" = "true" ]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi;
14
24
  rvm:
15
- - 2.4.1
25
+ - 2.5.3
26
+ - 2.4.2
16
27
  - 2.3.2
17
- - jruby-9.1.8.0
18
- env: STYLE=false
28
+ - 2.2.7
29
+ - jruby-9.2.0.0
30
+ matrix:
31
+ fast_finish: true
32
+ include:
33
+ - rvm: 2.5.3
34
+ gemfile: gemfiles/sidekiq_develop.gemfile
35
+ env: COV=true
19
36
  gemfile:
20
37
  - gemfiles/sidekiq_develop.gemfile
21
38
  - gemfiles/sidekiq_4.0.gemfile
22
39
  - gemfiles/sidekiq_4.1.gemfile
23
40
  - gemfiles/sidekiq_4.2.gemfile
24
41
  - gemfiles/sidekiq_5.0.gemfile
42
+ - gemfiles/sidekiq_5.1.gemfile
43
+ - gemfiles/sidekiq_5.2.gemfile
25
44
 
26
45
  notifications:
27
46
  email:
28
47
  recipients:
29
48
  - mikael@zoolutions.se
30
- matrix:
31
- fast_finish: true
32
- include:
33
- - rvm: 2.4.1
34
- gemfile: gemfiles/sidekiq_develop.gemfile
35
- env: STYLE=true
36
- addons:
37
- code_climate:
38
- repo_token: 88e524e8f638efe690def7a6e2c72b1a9db5cdfa74548921b734d609a5858ee5
data/Appraisals CHANGED
@@ -17,5 +17,13 @@ appraise 'sidekiq-4.2' do
17
17
  end
18
18
 
19
19
  appraise 'sidekiq-5.0' do
20
- gem 'sidekiq', '>= 5.0.0.beta', '< 6'
20
+ gem 'sidekiq', '>= 5.0.0', '< 5.1'
21
+ end
22
+
23
+ appraise 'sidekiq-5.1' do
24
+ gem 'sidekiq', '>= 5.1.0', '< 5.2'
25
+ end
26
+
27
+ appraise 'sidekiq-5.2' do
28
+ gem 'sidekiq', '>= 5.2.0', '< 6'
21
29
  end
data/Gemfile CHANGED
@@ -3,18 +3,19 @@
3
3
  source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
- gem 'appraisal', '~> 2.0.0'
6
+ gem 'appraisal', '>= 2.0.0'
7
7
  gem 'rspec-its', require: false
8
8
  gem 'rspec-wait', require: false
9
9
 
10
- platforms :mri_24 do
11
- gem 'benchmark-ips', require: false
12
- gem 'codeclimate-test-reporter', require: false
13
- gem 'fasterer', require: false
14
- gem 'memory_profiler', require: false
15
- gem 'mock_redis', require: false
16
- gem 'pry-byebug', require: false
17
- gem 'rubocop', require: false
18
- gem 'simplecov-json', require: false
19
- gem 'travis', require: false
10
+ platforms :mri_25 do
11
+ gem 'benchmark-ips', require: false
12
+ gem 'codeclimate-test-reporter', '>= 1.0.8', require: false
13
+ gem 'fasterer', require: false
14
+ gem 'memory_profiler', require: false
15
+ gem 'mock_redis', require: false
16
+ gem 'pry-byebug', require: false
17
+ gem 'rubocop', require: false
18
+ gem 'simplecov', '>= 0.13', require: false
19
+ gem 'simplecov-json', require: false
20
+ gem 'travis', require: false
20
21
  end
@@ -38,9 +38,7 @@ module SidekiqUniqueJobs
38
38
  end
39
39
 
40
40
  def lock(scope)
41
- if scope.to_sym != :client
42
- raise ArgumentError, "#{scope} middleware can't #{__method__} #{unique_key}"
43
- end
41
+ raise ArgumentError, "#{scope} middleware can't #{__method__} #{unique_key}" if scope.to_sym != :client
44
42
 
45
43
  Scripts::AcquireLock.execute(
46
44
  redis_pool,
@@ -49,7 +47,6 @@ module SidekiqUniqueJobs
49
47
  max_lock_time,
50
48
  )
51
49
  end
52
- # rubocop:enable MethodLength
53
50
 
54
51
  def unique_key
55
52
  @unique_key ||= UniqueArgs.digest(item)
@@ -43,8 +43,8 @@ module SidekiqUniqueJobs
43
43
  end
44
44
 
45
45
  def create_digest
46
- @unique_digest ||= @item[UNIQUE_DIGEST_KEY]
47
- @unique_digest ||= SidekiqUniqueJobs::UniqueArgs.digest(@item)
46
+ @create_digest ||= @item[UNIQUE_DIGEST_KEY]
47
+ @create_digest ||= SidekiqUniqueJobs::UniqueArgs.digest(@item)
48
48
  end
49
49
  end
50
50
  end
@@ -56,14 +56,11 @@ module SidekiqUniqueJobs
56
56
 
57
57
  stored_time = conn.get(unique_key)
58
58
  if stored_time && stored_time < time
59
- if conn.set(unique_key, time + expires, xx: true, ex: expires)
60
- return 1
61
- end
59
+ return 1 if conn.set(unique_key, time + expires, xx: true, ex: expires)
62
60
  end
63
61
 
64
62
  return 0
65
63
  end
66
64
  end
67
65
  end
68
- # rubocop:enable MethodLength
69
66
  end
@@ -37,8 +37,8 @@ module SidekiqUniqueJobs
37
37
  end
38
38
  end
39
39
 
40
- def handle_error(ex, file_name, redis_pool, options = {})
41
- if ex.message == 'NOSCRIPT No matching script. Please use EVAL.' # rubocop:disable Style/GuardClause
40
+ def handle_error(exception, file_name, redis_pool, options = {})
41
+ if exception.message == 'NOSCRIPT No matching script. Please use EVAL.' # rubocop:disable Style/GuardClause
42
42
  SCRIPT_SHAS.delete(file_name)
43
43
  call(file_name, redis_pool, options)
44
44
  else
@@ -7,7 +7,6 @@ module Sidekiq
7
7
  module UniqueExtension
8
8
  def self.included(base)
9
9
  base.class_eval do
10
- include SidekiqUniqueJobs::Unlockable
11
10
  alias_method :delete_orig, :delete
12
11
  alias_method :delete, :delete_ext
13
12
  alias_method :remove_job_orig, :remove_job
@@ -36,7 +35,6 @@ module Sidekiq
36
35
  module UniqueExtension
37
36
  def self.included(base)
38
37
  base.class_eval do
39
- include SidekiqUniqueJobs::Unlockable
40
38
  alias_method :delete_orig, :delete
41
39
  alias_method :delete, :delete_ext
42
40
  end
@@ -45,13 +43,6 @@ module Sidekiq
45
43
  def delete_ext
46
44
  SidekiqUniqueJobs::Unlockable.unlock(item) if delete_orig
47
45
  end
48
-
49
- def remove_job_ext
50
- remove_job_orig do |message|
51
- SidekiqUniqueJobs::Unlockable.unlock(Sidekiq.load_json(message))
52
- yield message
53
- end
54
- end
55
46
  end
56
47
  include UniqueExtension
57
48
  end
@@ -60,15 +51,14 @@ module Sidekiq
60
51
  module UniqueExtension
61
52
  def self.included(base)
62
53
  base.class_eval do
63
- include SidekiqUniqueJobs::Unlockable
64
54
  alias_method :delete_orig, :delete
65
55
  alias_method :delete, :delete_ext
66
56
  end
67
57
  end
68
58
 
69
59
  def delete_ext
70
- SidekiqUniqueJobs::Unlockable.unlock(item)
71
60
  delete_orig
61
+ SidekiqUniqueJobs::Unlockable.unlock(item)
72
62
  end
73
63
  end
74
64
 
@@ -79,7 +69,6 @@ module Sidekiq
79
69
  module UniqueExtension
80
70
  def self.included(base)
81
71
  base.class_eval do
82
- include SidekiqUniqueJobs::Unlockable
83
72
  alias_method :clear_orig, :clear
84
73
  alias_method :clear, :clear_ext
85
74
  end
@@ -98,7 +87,6 @@ module Sidekiq
98
87
  module UniqueExtension
99
88
  def self.included(base)
100
89
  base.class_eval do
101
- include SidekiqUniqueJobs::Unlockable
102
90
  if base.method_defined?(:clear)
103
91
  alias_method :clear_orig, :clear
104
92
  alias_method :clear, :clear_ext
@@ -146,4 +146,5 @@ module SidekiqUniqueJobs
146
146
  @unique_args_method ||= Sidekiq.default_worker_options.stringify_keys[UNIQUE_ARGS_KEY]
147
147
  end
148
148
  end
149
+ # rubocop:enable ClassLength
149
150
  end
@@ -10,12 +10,9 @@ module SidekiqUniqueJobs
10
10
  end
11
11
 
12
12
  def unlock_by_key(unique_key, jid, redis_pool = nil)
13
- return false unless Scripts::ReleaseLock.execute(redis_pool, unique_key, jid)
14
- after_unlock(jid)
15
- end
16
-
17
- def after_unlock(jid)
13
+ lock_released = Scripts::ReleaseLock.execute(redis_pool, unique_key, jid)
18
14
  ensure_job_id_removed(jid)
15
+ lock_released
19
16
  end
20
17
 
21
18
  def ensure_job_id_removed(jid)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqUniqueJobs
4
- VERSION = '5.0.10'
4
+ VERSION = '5.0.11'
5
5
  end
@@ -12,7 +12,7 @@ if stored_jid then
12
12
  end
13
13
 
14
14
  if redis.pcall('set', unique_key, job_id, 'nx', 'ex', expires) then
15
- redis.pcall('hsetnx', 'uniquejobs', job_id, unique_key)
15
+ -- redis.pcall('hsetnx', 'uniquejobs', job_id, unique_key)
16
16
  return 1
17
17
  else
18
18
  return 0
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
20
20
  end
21
21
 
22
22
  spec.require_paths = ['lib']
23
- spec.add_dependency 'sidekiq', '>= 4.0', '<= 6.0'
23
+ spec.add_dependency 'sidekiq', '>= 4.0', '< 6.0'
24
+ spec.add_dependency 'concurrent-ruby', '>= 1.0.2'
24
25
  spec.add_dependency 'thor', '~> 0'
25
26
 
26
27
  spec.add_development_dependency 'rspec', '~> 3.1'
@@ -28,5 +29,4 @@ Gem::Specification.new do |spec|
28
29
  spec.add_development_dependency 'timecop', '~> 0.8'
29
30
  spec.add_development_dependency 'yard', '~> 0.9'
30
31
  spec.add_development_dependency 'gem-release', '~> 0.7'
31
- spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.8'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-unique-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.10
4
+ version: 5.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-19 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
- - - "<="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '6.0'
23
23
  type: :runtime
@@ -27,9 +27,23 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4.0'
30
- - - "<="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: concurrent-ruby
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.0.2
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.2
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: thor
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -114,26 +128,6 @@ dependencies:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
130
  version: '0.7'
117
- - !ruby/object:Gem::Dependency
118
- name: codeclimate-test-reporter
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '1.0'
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 1.0.8
127
- type: :development
128
- prerelease: false
129
- version_requirements: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - "~>"
132
- - !ruby/object:Gem::Version
133
- version: '1.0'
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: 1.0.8
137
131
  description: Handles various types of unique jobs for Sidekiq
138
132
  email:
139
133
  - mikael@zoolutions.se
@@ -217,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
211
  version: '0'
218
212
  requirements: []
219
213
  rubyforge_project:
220
- rubygems_version: 2.6.12
214
+ rubygems_version: 2.7.7
221
215
  signing_key:
222
216
  specification_version: 4
223
217
  summary: Uniqueness for Sidekiq Jobs