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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f8e7a6d17bfa0e11c8f4092e5b28a97fab649014e89e8803db77b72743c92f8
4
- data.tar.gz: 5c06393f08a07ae68427a523f4d2d308c710ecdd03f502b8d1d0734542a53416
3
+ metadata.gz: 943a1686f6d726dbfaeb2af88c06c53673e74a6a77c6004dd5d1fc1045615876
4
+ data.tar.gz: 29185dfe629ff4d5d23d62a7725f30a28382ce83668ceee1af94d1698a12ba42
5
5
  SHA512:
6
- metadata.gz: 9b4dfb8e5d2569537c218619ac2883e07efd6370bc919af1a29bb1751ddf790a04ff3b39e26f7910b1b82aa0aeac55f638f107a162723ca730f947ab05e8d159
7
- data.tar.gz: f99d75d0ab683ec32a36b3f25008fb827c1b2d9da125c81234b7bd36bf9dba8df4f65839e6f3266338c1235f050f5a4d061cbebaabeabe1cc4a6543fcf2cff52
6
+ metadata.gz: c85434bf9328afd1cefcc9cc709671e1b854dd171a72851337bf5a9a640c63c835c7edaf0e5f14baf95dfe782dca848356c6c174bb871954f349ec0a26d2e623
7
+ data.tar.gz: ab7c29c49cd76e1499408dc08fb36e72e4cef65fcf1bcf8b971af7601f4957a5ba8a1faa614eab6af0c6278982eb49970e1372fa7dbfa1bc78abd3a695149222
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.151)
4
+ istox (0.1.152.debug.1)
5
5
  awesome_print
6
6
  binding_of_caller
7
7
  bunny (>= 2.12.0)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.152.debug.1'.freeze
2
+ VERSION = '0.1.152.debug.2'.freeze
3
3
  end
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.1
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-17 00:00:00.000000000 Z
11
+ date: 2020-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print