eventq_base 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eventq_base/nonce_manager.rb +17 -23
- data/lib/eventq_base/version.rb +1 -1
- data/lib/eventq_base.rb +0 -1
- metadata +1 -2
- data/lib/eventq_base/nonce_error.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9bc3112466190971bbe97e300c6f4ef72970648
|
4
|
+
data.tar.gz: 85a09ef777f2e608c4a2718f480f12c8354736a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45c1567f96f19ee6bad46b13952ba15310e8d1844d4f6ef8f05c3257ce04237e00207bb6416088c280a6c910d6396e558d4a87eac4413caa16427e90ad2c6e7
|
7
|
+
data.tar.gz: 71fd49d6da0e584d89fe579887af57456c85499a5b8f3308cc6521eaaa13e11dd6656c049dd530a82e889ca608b741990f3238f98b297008cab843790369944d
|
@@ -19,38 +19,32 @@ module EventQ
|
|
19
19
|
@lifespan
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
process_with_nonce(nonce, block)
|
27
|
-
|
28
|
-
else
|
29
|
-
|
30
|
-
process_without_nonce(block)
|
22
|
+
def self.is_allowed?(nonce)
|
23
|
+
if @server_url == nil
|
24
|
+
return true
|
25
|
+
end
|
31
26
|
|
27
|
+
lock = Redlock::Client.new([ @server_url ]).lock(nonce, @timeout)
|
28
|
+
if lock == false
|
29
|
+
EventQ.log(:info, "Message has already been processed: #{nonce}")
|
30
|
+
return false
|
32
31
|
end
|
33
32
|
|
34
33
|
return true
|
35
|
-
|
36
34
|
end
|
37
35
|
|
38
|
-
def self.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
lock = @server.lock(nonce, @timeout)
|
43
|
-
if lock == false
|
44
|
-
raise NonceError.new("Message has already been processed: #{nonce}")
|
36
|
+
def self.complete(nonce)
|
37
|
+
if @server_url != nil
|
38
|
+
Redis.new(url: @server_url).expire(nonce, @lifespan)
|
45
39
|
end
|
46
|
-
|
47
|
-
block.call
|
48
|
-
|
49
|
-
@redis.expire(nonce, @lifespan)
|
40
|
+
return true
|
50
41
|
end
|
51
42
|
|
52
|
-
def self.
|
53
|
-
|
43
|
+
def self.failed(nonce)
|
44
|
+
if @server_url != nil
|
45
|
+
Redis.new(url: @server_url).del(nonce)
|
46
|
+
end
|
47
|
+
return true
|
54
48
|
end
|
55
49
|
|
56
50
|
def self.reset
|
data/lib/eventq_base/version.rb
CHANGED
data/lib/eventq_base.rb
CHANGED
@@ -18,6 +18,5 @@ require_relative 'eventq_base/eventq_client_contract'
|
|
18
18
|
require_relative 'eventq_base/configuration'
|
19
19
|
require_relative 'eventq_base/serialization_providers'
|
20
20
|
require_relative 'eventq_base/worker_id'
|
21
|
-
require_relative 'eventq_base/nonce_error'
|
22
21
|
require_relative 'eventq_base/nonce_manager'
|
23
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventq_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
@@ -154,7 +154,6 @@ files:
|
|
154
154
|
- lib/eventq_base/eventq_logger.rb
|
155
155
|
- lib/eventq_base/exchange.rb
|
156
156
|
- lib/eventq_base/message_args.rb
|
157
|
-
- lib/eventq_base/nonce_error.rb
|
158
157
|
- lib/eventq_base/nonce_manager.rb
|
159
158
|
- lib/eventq_base/queue.rb
|
160
159
|
- lib/eventq_base/queue_message.rb
|