unique_job 0.2.1 → 0.3.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b243c0d4dea6a7399aa0a41dd0f2164e60de12db4b964b49df4a1964c4ae35fc
4
- data.tar.gz: 2a29407adb437d8cf3111aed035a2da17bb6da1147d086ad5d039a1880629fe2
3
+ metadata.gz: 9b63e8007f726ff6fa7024e33e896356a0f0a8165b811ef8df75fa890275e498
4
+ data.tar.gz: 763c15b9b7b7f68c98977c9c12fb91ab000fa3b884de9992de6a37d34a28c390
5
5
  SHA512:
6
- metadata.gz: 96526b267c18a5894593092aad3c9c455b657e3e81b251a8f55c77ec0c1f4034cc05f05797e0491c4ccaf51f985b1fb2b504af8dbe82a5a60d323905b4e63586
7
- data.tar.gz: 653dba5f3c033debbd67e68d7aa3a79c15b0ca03c7488cc6113edfbff57c3199e7abdfa669fc932519fcc636a16174b03c109663674b16f4efd7d37569f567ca
6
+ metadata.gz: f1e5231116d67db01e395a3788b54d9a94cf94dd0ea691fe6feff2a5e7f7a79008b9b011badce76074dd03bd1c4857a633b6cc1975644a313b5d0c633f5ba6e7
7
+ data.tar.gz: dcc61ef6f05b02d7bb8a285e429ff7499332341ba2ba10a7a6f6609e8505dbf065f227aa08eec3460b9c981f7cc5ae2c5977ba9aeecf9355ec21c85904d675af
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unique_job (0.2.1)
4
+ unique_job (0.3.0.pre)
5
5
  redis
6
6
  sidekiq (> 6.0, < 7.0)
7
7
 
@@ -9,17 +9,14 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  connection_pool (2.2.3)
12
- minitest (5.11.3)
13
- rack (2.2.2)
14
- rack-protection (2.0.8.1)
15
- rack
16
- rake (12.3.2)
17
- redis (4.2.1)
18
- sidekiq (6.0.7)
12
+ minitest (5.14.2)
13
+ rack (2.2.3)
14
+ rake (12.3.3)
15
+ redis (4.2.2)
16
+ sidekiq (6.1.2)
19
17
  connection_pool (>= 2.2.2)
20
18
  rack (~> 2.0)
21
- rack-protection (>= 2.0.0)
22
- redis (>= 4.1.0)
19
+ redis (>= 4.2.0)
23
20
 
24
21
  PLATFORMS
25
22
  ruby
@@ -8,9 +8,10 @@ module UniqueJob
8
8
  def perform_if_unique(worker, args, &block)
9
9
  if worker.respond_to?(:unique_key)
10
10
  unique_key = worker.unique_key(*args)
11
+ logger.debug { "[UniqueJob] Calculate unique key worker=#{worker.class} key=#{unique_key}" }
11
12
 
12
13
  if unique_key.nil? || unique_key.to_s.empty?
13
- logger.warn { "#{self.class}##{__method__} Key is blank worker=#{worker.class} args=#{truncate(args.inspect)}" }
14
+ logger.warn { "[UniqueJob] Don't check a job with a blank key worker=#{worker.class} key=#{unique_key}" }
14
15
  yield
15
16
  elsif perform_unique_check(worker, args, unique_key.to_s)
16
17
  yield
@@ -24,7 +25,7 @@ module UniqueJob
24
25
  history = job_history(worker)
25
26
 
26
27
  if history.exists?(unique_key)
27
- logger.info { "#{self.class}##{__method__} Skip duplicate job for #{history.ttl} seconds, remaining #{history.ttl(unique_key)} seconds worker=#{worker.class} args=#{truncate(args.inspect)} key=#{unique_key}" }
28
+ logger.info { "[UniqueJob] Skip duplicate job worker=#{worker.class} key=#{unique_key}" }
28
29
 
29
30
  perform_callback(worker, :after_skip, args)
30
31
 
@@ -59,8 +60,7 @@ module UniqueJob
59
60
  worker.send(callback_name, *args)
60
61
  end
61
62
  rescue ArgumentError => e
62
- message = "The number of parameters of the callback method (#{parameters.size}) is not the same as the number of arguments (#{args.size})"
63
- raise ArgumentError.new("#{self.class}:#{worker.class} #{message} callback_name=#{callback_name} args=#{args.inspect} parameters=#{parameters.inspect}")
63
+ raise ArgumentError.new("[UniqueJob] Invalid parameters callback=#{callback_name}")
64
64
  end
65
65
  end
66
66
  end
@@ -1,3 +1,3 @@
1
1
  module UniqueJob
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unique_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - ts-3156
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-18 00:00:00.000000000 Z
11
+ date: 2021-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -52,6 +52,7 @@ extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
54
  - ".gitignore"
55
+ - ".ruby-version"
55
56
  - ".travis.yml"
56
57
  - CODE_OF_CONDUCT.md
57
58
  - Gemfile
@@ -87,12 +88,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
88
  version: 2.3.0
88
89
  required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
- - - ">="
91
+ - - ">"
91
92
  - !ruby/object:Gem::Version
92
- version: '0'
93
+ version: 1.3.1
93
94
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.7.6
95
+ rubygems_version: 3.1.6
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Set a uniqueness to Sidekiq jobs