activejob-uniqueness 0.3.1 → 0.3.2

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: 120483e1019cb9e65e1f270ae21d040d17a37d54e7fa6616800cdc7ff8180251
4
- data.tar.gz: c9b299e5e444e19cb1f2a3230447eb44ebd719bb2a93e3c0b2abe22f77782e47
3
+ metadata.gz: cb511653e8e225bda4efe0408f12b083994172a42e47de60fae20e05497fc40f
4
+ data.tar.gz: 59d9980246fb8c42e17f8fcc723b48c035d3c9bdffe3c5e899f425e277a231c4
5
5
  SHA512:
6
- metadata.gz: 5742577b735a3749612b194b6d8912a72938ffaab6b2cb470448fce0342c39a265e99a0fa043f405eaf90ef03f1844fa913331095d13a9a9f968ece3e75265fa
7
- data.tar.gz: 4d22df0933705d5aa22fec6d47add7a6d61e6adab20afb9d8a0557cc6c35907d75491ac07a1bd0e71ea2e4fb59a6d6468ece7e8387c2ee954cc6e1078aa55326
6
+ metadata.gz: 68b535216f33f227330202077d672ed768c95dbe2044488501d8a95925c26d204f1395954170afd9420b2da351fa79cf112d0d2f114dbccd1a21607fdfa03403
7
+ data.tar.gz: a53f4053972e88b33e515f643b65dfd1d6dd3b389b8a2849094cc23b4a5d766c32a30cfbe69bc8ad5b323917dc904934ccdf5cffa33a8330a899825a3428708f
data/CHANGELOG.md CHANGED
@@ -3,7 +3,15 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
5
 
6
- ## [Unreleased](https://github.com/veeqo/activejob-uniqueness/compare/v0.3.1...HEAD)
6
+ ## [Unreleased](https://github.com/veeqo/activejob-uniqueness/compare/v0.3.2...HEAD)
7
+
8
+ ## [0.3.2](https://github.com/veeqo/activejob-uniqueness/compare/v0.3.1...v0.3.2) - 2024-08-16
9
+
10
+ ### Added
11
+ - [#80](https://github.com/veeqo/activejob-uniqueness/pull/80) Add rails 7.2 support by [viralpraxis]
12
+
13
+ ### Changed
14
+ - [#74](https://github.com/veeqo/activejob-uniqueness/pull/74) Fix log subscriber by [@shahidkhaliq]
7
15
 
8
16
  ## [0.3.1](https://github.com/veeqo/activejob-uniqueness/compare/v0.3.0...v0.3.1) - 2023-10-30
9
17
 
@@ -3,98 +3,100 @@
3
3
  require 'active_support/log_subscriber'
4
4
 
5
5
  module ActiveJob
6
- class LogSubscriber < ActiveSupport::LogSubscriber # :nodoc:
7
- def lock(event)
8
- job = event.payload[:job]
9
- resource = event.payload[:resource]
10
-
11
- debug do
12
- "Locked #{lock_info(job, resource)}" + args_info(job)
6
+ module Uniqueness
7
+ class LogSubscriber < ActiveSupport::LogSubscriber # :nodoc:
8
+ def lock(event)
9
+ job = event.payload[:job]
10
+ resource = event.payload[:resource]
11
+
12
+ debug do
13
+ "Locked #{lock_info(job, resource)}" + args_info(job)
14
+ end
13
15
  end
14
- end
15
16
 
16
- def runtime_lock(event)
17
- job = event.payload[:job]
18
- resource = event.payload[:resource]
17
+ def runtime_lock(event)
18
+ job = event.payload[:job]
19
+ resource = event.payload[:resource]
19
20
 
20
- debug do
21
- "Locked runtime #{lock_info(job, resource)}" + args_info(job)
21
+ debug do
22
+ "Locked runtime #{lock_info(job, resource)}" + args_info(job)
23
+ end
22
24
  end
23
- end
24
25
 
25
- def unlock(event)
26
- job = event.payload[:job]
27
- resource = event.payload[:resource]
26
+ def unlock(event)
27
+ job = event.payload[:job]
28
+ resource = event.payload[:resource]
28
29
 
29
- debug do
30
- "Unlocked #{lock_info(job, resource)}"
30
+ debug do
31
+ "Unlocked #{lock_info(job, resource)}"
32
+ end
31
33
  end
32
- end
33
34
 
34
- def runtime_unlock(event)
35
- job = event.payload[:job]
36
- resource = event.payload[:resource]
35
+ def runtime_unlock(event)
36
+ job = event.payload[:job]
37
+ resource = event.payload[:resource]
37
38
 
38
- debug do
39
- "Unlocked runtime #{lock_info(job, resource)}"
39
+ debug do
40
+ "Unlocked runtime #{lock_info(job, resource)}"
41
+ end
40
42
  end
41
- end
42
43
 
43
- def conflict(event)
44
- job = event.payload[:job]
45
- resource = event.payload[:resource]
44
+ def conflict(event)
45
+ job = event.payload[:job]
46
+ resource = event.payload[:resource]
46
47
 
47
- info do
48
- "Not unique #{lock_info(job, resource)}" + args_info(job)
48
+ info do
49
+ "Not unique #{lock_info(job, resource)}" + args_info(job)
50
+ end
49
51
  end
50
- end
51
52
 
52
- def runtime_conflict(event)
53
- job = event.payload[:job]
54
- resource = event.payload[:resource]
53
+ def runtime_conflict(event)
54
+ job = event.payload[:job]
55
+ resource = event.payload[:resource]
55
56
 
56
- info do
57
- "Not unique runtime #{lock_info(job, resource)}" + args_info(job)
57
+ info do
58
+ "Not unique runtime #{lock_info(job, resource)}" + args_info(job)
59
+ end
58
60
  end
59
- end
60
61
 
61
- private
62
+ private
62
63
 
63
- def lock_info(job, resource)
64
- "#{job.class.name} (Job ID: #{job.job_id}) (Lock key: #{resource})"
65
- end
64
+ def lock_info(job, resource)
65
+ "#{job.class.name} (Job ID: #{job.job_id}) (Lock key: #{resource})"
66
+ end
66
67
 
67
- def args_info(job)
68
- if job.arguments.any? && log_arguments?(job)
69
- " with arguments: #{job.arguments.map { |arg| format(arg).inspect }.join(', ')}"
70
- else
71
- ''
68
+ def args_info(job)
69
+ if job.arguments.any? && log_arguments?(job)
70
+ " with arguments: #{job.arguments.map { |arg| format(arg).inspect }.join(', ')}"
71
+ else
72
+ ''
73
+ end
72
74
  end
73
- end
74
75
 
75
- def log_arguments?(job)
76
- return true unless job.class.respond_to?(:log_arguments?)
76
+ def log_arguments?(job)
77
+ return true unless job.class.respond_to?(:log_arguments?)
77
78
 
78
- job.class.log_arguments?
79
- end
79
+ job.class.log_arguments?
80
+ end
80
81
 
81
- def format(arg)
82
- case arg
83
- when Hash
84
- arg.transform_values { |value| format(value) }
85
- when Array
86
- arg.map { |value| format(value) }
87
- when GlobalID::Identification
88
- arg.to_global_id rescue arg
89
- else
90
- arg
82
+ def format(arg)
83
+ case arg
84
+ when Hash
85
+ arg.transform_values { |value| format(value) }
86
+ when Array
87
+ arg.map { |value| format(value) }
88
+ when GlobalID::Identification
89
+ arg.to_global_id rescue arg
90
+ else
91
+ arg
92
+ end
91
93
  end
92
- end
93
94
 
94
- def logger
95
- ActiveJob::Base.logger
95
+ def logger
96
+ ActiveJob::Base.logger
97
+ end
96
98
  end
97
99
  end
98
100
  end
99
101
 
100
- ActiveJob::LogSubscriber.attach_to :active_job_uniqueness
102
+ ActiveJob::Uniqueness::LogSubscriber.attach_to :active_job_uniqueness
@@ -41,7 +41,7 @@ module ActiveJob
41
41
  module ScheduledSet
42
42
  def delete(score, job_id)
43
43
  entry = find_job(job_id)
44
- ActiveJob::Uniqueness.unlock_sidekiq_job!(entry.item) if super(score, job_id)
44
+ ActiveJob::Uniqueness.unlock_sidekiq_job!(entry.item) if super
45
45
  entry
46
46
  end
47
47
  end
@@ -67,7 +67,7 @@ module ActiveJob
67
67
  end
68
68
 
69
69
  def delete_by_value(name, value)
70
- ActiveJob::Uniqueness.unlock_sidekiq_job!(Sidekiq.load_json(value)) if super(name, value)
70
+ ActiveJob::Uniqueness.unlock_sidekiq_job!(Sidekiq.load_json(value)) if super
71
71
  end
72
72
  end
73
73
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveJob
4
4
  module Uniqueness
5
- VERSION = '0.3.1'
5
+ VERSION = '0.3.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activejob-uniqueness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Sharshenov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-30 00:00:00.000000000 Z
11
+ date: 2024-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '7.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.2'
32
+ version: '7.3'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: redlock
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  requirements: []
190
- rubygems_version: 3.2.33
190
+ rubygems_version: 3.3.27
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Ensure uniqueness of your ActiveJob jobs