activejob-uniqueness 0.2.3 → 0.2.5

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: 47756fe648b47e5e2be0c37e2d57d8ddc13beea68eff40cba671002813965b25
4
- data.tar.gz: 8d9aeec1c29e60b4f98eb7f5ce77be820238f84e2e103175fc039fd7fac5aeca
3
+ metadata.gz: 9554ab5de5c83f0af7528f4618155b8cd4b68673760fdc7c6113bce6fd2f2f53
4
+ data.tar.gz: 69849f32a26a29f2c644c2a6749c7ca45221f2d04650d369880a2e5050005d0f
5
5
  SHA512:
6
- metadata.gz: 1903499d9c4f069ffc62df68353475404aac537e2eb65561e26f4d2fa527a75b0e9edb2c8e69a55a2c5ca3e13ee35891c7ab7292bd25647a8db89970d3f6696e
7
- data.tar.gz: 9893c234256d0e91e988cdd7a1acf8db8a6e29bca23363d194f8c8f1b48d6d631347a5ad7c9299269eb0dccf35390900c71a28a824b55df4d9c4d6ba2c5e38e7
6
+ metadata.gz: c661da1de663277171fd5d8fff5a89f54c1dee158c26383863b359439e64e3a29d4d4a611ec16a6e7e13c953eea1abce017d225e242a9877a423ffd8a1aaa486
7
+ data.tar.gz: 4300874d054bb6b33eb0e6960fe63c2497b193e6cca64e32bf2b77a3d886c21919478e915434f995855f625cacc36155be0519fc296026de5a7cd2cad5038795
data/CHANGELOG.md CHANGED
@@ -3,13 +3,33 @@ 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.2.3...HEAD)
6
+ ## [Unreleased](https://github.com/veeqo/activejob-uniqueness/compare/v0.2.5...HEAD)
7
+
8
+
9
+ ## [0.2.5](https://github.com/veeqo/activejob-uniqueness/compare/v0.2.4...v0.2.5) - 2023-02-01
10
+
11
+ ### Added
12
+ - [#45](https://github.com/veeqo/activejob-uniqueness/pull/45) Add Dependabot for GitHub Actions by [@petergoldstein](https://github.com/petergoldstein)
13
+ - [#51](https://github.com/veeqo/activejob-uniqueness/pull/51) Add support for Sidekiq 7 by [@dwightwatson](https://github.com/dwightwatson)
14
+ - [#52](https://github.com/veeqo/activejob-uniqueness/pull/52) Add Ruby 3.2.0 to the CI matrix by [@petergoldstein](https://github.com/petergoldstein)
15
+
16
+ ### Changed
17
+ - [#46](https://github.com/veeqo/activejob-uniqueness/pull/46) Fix a method name typo in CHANGELOG by [@y-yagi](https://github.com/y-yagi)
18
+
19
+ ## [0.2.4](https://github.com/veeqo/activejob-uniqueness/compare/v0.2.3...v0.2.4) - 2022-06-22
20
+
21
+ ### Added
22
+ - [#43](https://github.com/veeqo/activejob-uniqueness/pull/43) Run rubocop on Github Actions
23
+ - [#44](https://github.com/veeqo/activejob-uniqueness/pull/44) Add ActiveJob::Uniqueness.reset_manager! method to reset lock manager by [@akostadinov](https://github.com/akostadinov)
24
+
25
+ ### Changed
26
+ - [#42](https://github.com/veeqo/activejob-uniqueness/pull/42) Actualize rubies and gems for tests
7
27
 
8
28
  ## [0.2.3](https://github.com/veeqo/activejob-uniqueness/compare/v0.2.2...v0.2.3) - 2022-02-28
9
29
 
10
30
  ### Added
11
31
  - [#36](https://github.com/veeqo/activejob-uniqueness/pull/36) Support ActiveJob/Rails 7.0
12
- - [#37](https://github.com/veeqo/activejob-uniqueness/pull/37) Add Ruby 3.1 to CI by [@petergoldstein]
32
+ - [#37](https://github.com/veeqo/activejob-uniqueness/pull/37) Add Ruby 3.1 to CI by [@petergoldstein](https://github.com/petergoldstein)
13
33
 
14
34
  ## [0.2.2](https://github.com/veeqo/activejob-uniqueness/compare/v0.2.1...v0.2.2) - 2021-10-22
15
35
 
@@ -40,7 +40,7 @@ module ActiveJob
40
40
  [
41
41
  lock_prefix,
42
42
  normalized_job_class_name,
43
- arguments.any? ? arguments_key_part + '*' : '*'
43
+ arguments.any? ? "#{arguments_key_part}*" : '*'
44
44
  ].compact.join(':')
45
45
  end
46
46
 
@@ -9,7 +9,7 @@ module ActiveJob
9
9
  # Unlocks a resource by resource only.
10
10
  def delete_lock(resource)
11
11
  @servers.each do |server|
12
- server.instance_variable_get(:'@redis').with do |conn|
12
+ server.instance_variable_get(:@redis).with do |conn|
13
13
  conn.del resource
14
14
  end
15
15
  end
@@ -20,7 +20,7 @@ module ActiveJob
20
20
  # Unlocks multiple resources by key wildcard.
21
21
  def delete_locks(wildcard)
22
22
  @servers.each do |server|
23
- server.instance_variable_get(:'@redis').with do |conn|
23
+ server.instance_variable_get(:@redis).with do |conn|
24
24
  conn.scan_each(match: wildcard).each { |key| conn.del key }
25
25
  end
26
26
  end
@@ -3,7 +3,7 @@
3
3
  require 'active_support/log_subscriber'
4
4
 
5
5
  module ActiveJob
6
- class LogSubscriber < ActiveSupport::LogSubscriber #:nodoc:
6
+ class LogSubscriber < ActiveSupport::LogSubscriber # :nodoc:
7
7
  def lock(event)
8
8
  job = event.payload[:job]
9
9
  resource = event.payload[:resource]
@@ -66,8 +66,7 @@ module ActiveJob
66
66
 
67
67
  def args_info(job)
68
68
  if job.arguments.any? && log_arguments?(job)
69
- ' with arguments: ' +
70
- job.arguments.map { |arg| format(arg).inspect }.join(', ')
69
+ " with arguments: #{job.arguments.map { |arg| format(arg).inspect }.join(', ')}"
71
70
  else
72
71
  ''
73
72
  end
@@ -91,6 +91,8 @@ end
91
91
 
92
92
  # Global death handlers are introduced in Sidekiq 5.1
93
93
  # https://github.com/mperham/sidekiq/blob/e7acb124fbeb0bece0a7c3d657c39a9cc18d72c6/Changes.md#510
94
- if sidekiq_version >= Gem::Version.new('5.1')
94
+ if sidekiq_version >= Gem::Version.new('7.0')
95
+ Sidekiq.default_configuration.death_handlers << ->(job, _ex) { ActiveJob::Uniqueness.unlock_sidekiq_job!(job) }
96
+ elsif sidekiq_version >= Gem::Version.new('5.1')
95
97
  Sidekiq.death_handlers << ->(job, _ex) { ActiveJob::Uniqueness.unlock_sidekiq_job!(job) }
96
98
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveJob
4
4
  module Uniqueness
5
- VERSION = '0.2.3'
5
+ VERSION = '0.2.5'
6
6
  end
7
7
  end
@@ -38,6 +38,10 @@ module ActiveJob
38
38
  def test_mode!
39
39
  @lock_manager = ActiveJob::Uniqueness::TestLockManager.new
40
40
  end
41
+
42
+ def reset_manager!
43
+ @lock_manager = nil
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -15,7 +15,7 @@ ActiveJob::Uniqueness.configure do |config|
15
15
  # Allowed values are
16
16
  # :raise - raises ActiveJob::Uniqueness::JobNotUnique
17
17
  # :log - instruments ActiveSupport::Notifications and logs event to the ActiveJob::Logger
18
- # proc - custom Proc. For example, ->(job) { job.logger.info('Oops') }
18
+ # proc - custom Proc. For example, ->(job) { job.logger.info("Job already in queue: #{job.class.name} #{job.arguments.inspect} (#{job.job_id})") }
19
19
  #
20
20
  # config.on_conflict = :raise
21
21
 
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.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Sharshenov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -106,6 +106,34 @@ dependencies:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '3.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: rubocop
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '1.28'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '1.28'
123
+ - !ruby/object:Gem::Dependency
124
+ name: rubocop-rspec
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '2.10'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '2.10'
109
137
  description: Ensure uniqueness of your ActiveJob jobs
110
138
  email:
111
139
  - rustam@sharshenov.com
@@ -143,6 +171,7 @@ metadata:
143
171
  homepage_uri: https://github.com/veeqo/activejob-uniqueness
144
172
  source_code_uri: https://github.com/veeqo/activejob-uniqueness
145
173
  changelog_uri: https://github.com/veeqo/activejob-uniqueness/blob/main/CHANGELOG.md
174
+ rubygems_mfa_required: 'true'
146
175
  post_install_message:
147
176
  rdoc_options: []
148
177
  require_paths: