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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb511653e8e225bda4efe0408f12b083994172a42e47de60fae20e05497fc40f
|
4
|
+
data.tar.gz: 59d9980246fb8c42e17f8fcc723b48c035d3c9bdffe3c5e899f425e277a231c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
17
|
+
def runtime_lock(event)
|
18
|
+
job = event.payload[:job]
|
19
|
+
resource = event.payload[:resource]
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
debug do
|
22
|
+
"Locked runtime #{lock_info(job, resource)}" + args_info(job)
|
23
|
+
end
|
22
24
|
end
|
23
|
-
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
def unlock(event)
|
27
|
+
job = event.payload[:job]
|
28
|
+
resource = event.payload[:resource]
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
debug do
|
31
|
+
"Unlocked #{lock_info(job, resource)}"
|
32
|
+
end
|
31
33
|
end
|
32
|
-
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
def runtime_unlock(event)
|
36
|
+
job = event.payload[:job]
|
37
|
+
resource = event.payload[:resource]
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
debug do
|
40
|
+
"Unlocked runtime #{lock_info(job, resource)}"
|
41
|
+
end
|
40
42
|
end
|
41
|
-
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
def conflict(event)
|
45
|
+
job = event.payload[:job]
|
46
|
+
resource = event.payload[:resource]
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
info do
|
49
|
+
"Not unique #{lock_info(job, resource)}" + args_info(job)
|
50
|
+
end
|
49
51
|
end
|
50
|
-
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
def runtime_conflict(event)
|
54
|
+
job = event.payload[:job]
|
55
|
+
resource = event.payload[:resource]
|
55
56
|
|
56
|
-
|
57
|
-
|
57
|
+
info do
|
58
|
+
"Not unique runtime #{lock_info(job, resource)}" + args_info(job)
|
59
|
+
end
|
58
60
|
end
|
59
|
-
end
|
60
61
|
|
61
|
-
|
62
|
+
private
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
def lock_info(job, resource)
|
65
|
+
"#{job.class.name} (Job ID: #{job.job_id}) (Lock key: #{resource})"
|
66
|
+
end
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
76
|
-
|
76
|
+
def log_arguments?(job)
|
77
|
+
return true unless job.class.respond_to?(:log_arguments?)
|
77
78
|
|
78
|
-
|
79
|
-
|
79
|
+
job.class.log_arguments?
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
-
|
95
|
-
|
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
|
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
|
70
|
+
ActiveJob::Uniqueness.unlock_sidekiq_job!(Sidekiq.load_json(value)) if super
|
71
71
|
end
|
72
72
|
end
|
73
73
|
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.
|
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:
|
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.
|
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.
|
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.
|
190
|
+
rubygems_version: 3.3.27
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: Ensure uniqueness of your ActiveJob jobs
|