que-unique 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b357182fa67d729fe7df9d7f9aa49bad80e5b1b137709b7c3e8196b4c2ad8e5
4
- data.tar.gz: 544cbdc1ac8dbc5d83b668a88a85c8849f2fbdbc9419a4381e54d4a8e5d5813d
3
+ metadata.gz: 190128804ed1f6eebb078c53eafad450dd4ac250e928035950cef22d19cd219b
4
+ data.tar.gz: 9ffcef6c846cd5805aca5abe1a2d569bfffdb7372e9e83670c39b0a5c851b9b5
5
5
  SHA512:
6
- metadata.gz: 29d378a89f1af3d75c1ec5be9d1fc0c1e2332d175fb5359788c0071e42922d7889aaed7a398cc9cb69b520a8f18cdc2c7d83ea99440c1d4cdb9d9e29254a1bd7
7
- data.tar.gz: d7321d93972f131531d10abb28746d9e1831cf4add8f14bd55d4dd213f170b6889f0a690805d81797646f0780fa44dfd0d30e3c31dfa92d2ce15f4fa2f0e1501
6
+ metadata.gz: a0fecc160423b939979d352b08dca730f0493a663c9815f1cdf776b37760e0345564a600c872dc084a37202b55c11dbd58a673e2f043b854db935986870d19af
7
+ data.tar.gz: 5da43b172697c587f6f2c66dbbb26c93887731b892a574dd30553d3b8cc91b47a452b07109fde044ab02db49b174f61422f4f5af3af1643669eccfec3789a36a
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Que
4
4
  module Unique
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
data/lib/que/unique.rb CHANGED
@@ -14,7 +14,7 @@ module Que
14
14
 
15
15
  included do
16
16
  singleton_class.class_eval do
17
- def enqueue_before_unique(*args)
17
+ def enqueue_before_unique(*args, **kwargs)
18
18
  thread_local_hash = Thread.current[Que::Unique::THREAD_LOCAL_KEY]
19
19
  unless thread_local_hash
20
20
  raise "UniqueQueJob #{self} being scheduled outside a transaction"
@@ -22,15 +22,17 @@ module Que
22
22
 
23
23
  # Once the args are canonicalised, we convert it to a JSON string to match against.
24
24
  canonicalised_args = args.map { |arg| Que::Unique.canonicalise_que_unique_arg(arg) }
25
- args_key = { self => canonicalised_args }.to_json
25
+ canonicalised_kwargs = Que::Unique.canonicalise_que_unique_arg(kwargs)
26
+ cache_key = { self => [canonicalised_args, canonicalised_kwargs] }.to_json
27
+
26
28
  # If this is already known then don't enqueue it again. Otherwise, add it to the last
27
29
  # element of the array.
28
- if thread_local_hash.key?(args_key)
29
- ::Rails.logger.debug "Que::Unique - #{self} - Already scheduled: #{args_key}"
30
+ if thread_local_hash.key?(cache_key)
31
+ ::Rails.logger.debug "Que::Unique - #{self} - Already scheduled: #{cache_key}"
30
32
  else
31
- ::Rails.logger.debug "Que::Unique - #{self} - Enqueuing #{args_key}"
32
- thread_local_hash[args_key] = true
33
- enqueue_after_unique(*canonicalised_args)
33
+ ::Rails.logger.debug "Que::Unique - #{self} - Enqueuing #{cache_key}"
34
+ thread_local_hash[cache_key] = true
35
+ enqueue_after_unique(*args, **kwargs)
34
36
  end
35
37
  end
36
38
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: que-unique
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bamboo Engineering
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-02-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: que
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '0.14'
18
+ version: '2.0'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 3.0.0
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: '0.14'
28
+ version: '2.0'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: 3.0.0
@@ -246,7 +245,6 @@ dependencies:
246
245
  - - ">="
247
246
  - !ruby/object:Gem::Version
248
247
  version: '0'
249
- description:
250
248
  email:
251
249
  - dev@bambooloans.com
252
250
  executables: []
@@ -265,7 +263,6 @@ metadata:
265
263
  source_code_uri: https://github.com/bambooengineering/que-unique
266
264
  changelog_uri: https://github.com/bambooengineering/que-unique/CHANGELOG.md
267
265
  rubygems_mfa_required: 'true'
268
- post_install_message:
269
266
  rdoc_options: []
270
267
  require_paths:
271
268
  - lib
@@ -280,8 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
277
  - !ruby/object:Gem::Version
281
278
  version: '0'
282
279
  requirements: []
283
- rubygems_version: 3.5.14
284
- signing_key:
280
+ rubygems_version: 3.6.7
285
281
  specification_version: 4
286
282
  summary: A gem that removes duplicates when multiple copies of a que job are enqueued.
287
283
  test_files: []