istox 0.1.152.debug.1 → 0.1.152.debug.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/istox/helpers/publisher.rb +36 -3
- data/lib/istox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 943a1686f6d726dbfaeb2af88c06c53673e74a6a77c6004dd5d1fc1045615876
|
4
|
+
data.tar.gz: 29185dfe629ff4d5d23d62a7725f30a28382ce83668ceee1af94d1698a12ba42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c85434bf9328afd1cefcc9cc709671e1b854dd171a72851337bf5a9a640c63c835c7edaf0e5f14baf95dfe782dca848356c6c174bb871954f349ec0a26d2e623
|
7
|
+
data.tar.gz: ab7c29c49cd76e1499408dc08fb36e72e4cef65fcf1bcf8b971af7601f4957a5ba8a1faa614eab6af0c6278982eb49970e1372fa7dbfa1bc78abd3a695149222
|
data/Gemfile.lock
CHANGED
@@ -54,6 +54,39 @@ module Istox
|
|
54
54
|
end
|
55
55
|
|
56
56
|
@connection = ::Istox::BunnyBoot.connection
|
57
|
+
|
58
|
+
# Start a thread to sweep @channel
|
59
|
+
Thread.new do
|
60
|
+
loop do
|
61
|
+
Thread.new do
|
62
|
+
# sleep 60 * 5
|
63
|
+
sleep 5
|
64
|
+
|
65
|
+
tid = []
|
66
|
+
Thread.list.each do |t|
|
67
|
+
tid << t.object_id
|
68
|
+
end
|
69
|
+
|
70
|
+
log.info("Current tid is #{tid}")
|
71
|
+
|
72
|
+
tid_c = @channel.keys
|
73
|
+
log.info("@channel tid is #{tid_c}")
|
74
|
+
|
75
|
+
tid_c.each do |t|
|
76
|
+
unless tid.include? t
|
77
|
+
# Close channel and remove it from @channel
|
78
|
+
log.info("Thread #{t} doesn't exist any more, close channel for it and remove it from @channel")
|
79
|
+
@channel[t]['confirm-0'].close
|
80
|
+
@channel[t]['confirm-1'].close
|
81
|
+
@channel[t]['noconfirm'].close
|
82
|
+
@channel.delete t
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end.join
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
@connection
|
57
90
|
end
|
58
91
|
end
|
59
92
|
|
@@ -70,7 +103,6 @@ module Istox
|
|
70
103
|
def channel
|
71
104
|
return @channel[Thread.current.object_id] if @channel.present? && @channel[Thread.current.object_id].present?
|
72
105
|
|
73
|
-
log.info "Current @channel object is: #{@channel}"
|
74
106
|
log.info "#{Thread.current.object_id} No channel yet, create 2 channels confirm-mode and non-confirm-mode ... ..."
|
75
107
|
@channel = Hash.new if @channel.nil?
|
76
108
|
@channel[Thread.current.object_id] = Hash.new
|
@@ -78,12 +110,14 @@ module Istox
|
|
78
110
|
@channel[Thread.current.object_id]['confirm-1'] = ::Istox::BunnyBoot.channel(connection, confirm: true)
|
79
111
|
@channel[Thread.current.object_id]['noconfirm'] = ::Istox::BunnyBoot.channel(connection, confirm: false)
|
80
112
|
|
113
|
+
log.info "Current @channel object is: #{@channel}"
|
114
|
+
|
81
115
|
threadId = Thread.current.object_id
|
82
116
|
# Start new thread on receiving ACK from 'confirm-1' channel on the specified thread
|
83
117
|
Thread.new do
|
118
|
+
log.info("Create thread #{Thread.current.object_id} for monitoring confirm-1")
|
84
119
|
loop do
|
85
120
|
sleep 5
|
86
|
-
log.info("Create thread #{Thread.current.object_id} for monitoring confirm-1")
|
87
121
|
begin
|
88
122
|
success = @channel[threadId]['confirm-1'].wait_for_confirms
|
89
123
|
if success
|
@@ -102,7 +136,6 @@ module Istox
|
|
102
136
|
routing_key = options.delete :routing_key
|
103
137
|
options[:delivery_tag] = n
|
104
138
|
end
|
105
|
-
|
106
139
|
publish(exchange: eid, routing_key: routing_key, message: payload, options: options)
|
107
140
|
end
|
108
141
|
end
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.152.debug.
|
4
|
+
version: 0.1.152.debug.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|