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 +4 -4
- data/lib/que/unique/version.rb +1 -1
- data/lib/que/unique.rb +9 -7
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 190128804ed1f6eebb078c53eafad450dd4ac250e928035950cef22d19cd219b
|
4
|
+
data.tar.gz: 9ffcef6c846cd5805aca5abe1a2d569bfffdb7372e9e83670c39b0a5c851b9b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0fecc160423b939979d352b08dca730f0493a663c9815f1cdf776b37760e0345564a600c872dc084a37202b55c11dbd58a673e2f043b854db935986870d19af
|
7
|
+
data.tar.gz: 5da43b172697c587f6f2c66dbbb26c93887731b892a574dd30553d3b8cc91b47a452b07109fde044ab02db49b174f61422f4f5af3af1643669eccfec3789a36a
|
data/lib/que/unique/version.rb
CHANGED
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
|
-
|
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?(
|
29
|
-
::Rails.logger.debug "Que::Unique - #{self} - Already scheduled: #{
|
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 #{
|
32
|
-
thread_local_hash[
|
33
|
-
enqueue_after_unique(*
|
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.
|
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:
|
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
|
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
|
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.
|
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: []
|