data_collector 0.39.0 → 0.41.0

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: 05ef65e41068e348fb98f4006fa50917f0d1f36b321193388e506dca9d912a07
4
- data.tar.gz: c711d472ea38bdcb999d1b2ef3701e6b6fc0f7933bac137aa65537decb0d3137
3
+ metadata.gz: 4a1ff20af153214903e447f712e1103d1ad3f31c0d78116f0d53ada7e0ca4870
4
+ data.tar.gz: 8daf87004c13c9842f2c6c8bd32de92064e17305ec05cdcff6cc2d9aff3b83a5
5
5
  SHA512:
6
- metadata.gz: 6093dea6542e5bb7a01d8149aff449912e606e1d482b0f5cf1d54a6845776592cbf84ee4fda979797aec66ceca00022ecc8e51fbdaf01123c6721aa879961c9b
7
- data.tar.gz: effdc6c09bf03c1d1683e3c95eda047078a9daedd4a31bf350b531b6760921e4a618f5693f07a26faa3ed77039db7ec2c1c622f03b951debfded1ca1fc16377d
6
+ metadata.gz: 614d463b0325b3d0a258e29eb1eb201e95123b77d0dfce47f798417f21a55a5c35b4d1109e6be563278dcedb0add4d275ee2408359a1727d5668d141497ba780
7
+ data.tar.gz: cc6429da9bb97ca08e01b9180d7eaedaa2800cf9b663c8486658a15371da45bb4f3650b833d885020af2034d59ccc249682d6590cbc4b333441af7e405092790
@@ -3,27 +3,27 @@ require 'connection_pool'
3
3
  module BunnyBurrow
4
4
  class Connection
5
5
  include Singleton
6
- attr_reader :connection, :started
6
+ attr_reader :connection
7
7
  attr_accessor :verify_peer, :connection_name, :rabbitmq_url
8
8
 
9
- def initialize
10
- super
11
- @started = false
12
- end
13
9
  def connection
14
- @connection ||= Bunny.new(@rabbitmq_url, verify_peer: @verify_peer, connection_name: @connection_name)
15
- unless @started
10
+ unless @connection
11
+ @connection = Bunny.new(@rabbitmq_url, verify_peer: @verify_peer, connection_name: @connection_name)
16
12
  @connection.start
17
- @started = true
18
13
  end
19
14
 
15
+ @connection.start unless @connection.connected? || @connection.closed?
16
+ #@connection.start if @connection.closed?
17
+
18
+ #pp @connection.status
19
+
20
20
  @connection
21
21
  end
22
22
 
23
23
  def channel
24
- @channel ||= ConnectionPool::Wrapper.new do
25
- connection.create_channel
26
- end
24
+ @channel = connection.create_channel unless @channel && @channel.open?
25
+
26
+ @channel
27
27
  end
28
28
  end
29
29
 
@@ -41,6 +41,7 @@ module BunnyBurrow
41
41
 
42
42
  unless @connection
43
43
  @connection = Connection.instance.connection
44
+ @connection.start unless @connection.open?
44
45
  end
45
46
 
46
47
  @connection
@@ -51,7 +52,7 @@ module BunnyBurrow
51
52
  Connection.instance.verify_peer = @verify_peer
52
53
  Connection.instance.rabbitmq_url = @rabbitmq_url
53
54
 
54
- @channel ||= Connection.instance.channel
55
+ @channel = Connection.instance.channel
55
56
  end
56
57
  end
57
58
  end
@@ -18,6 +18,8 @@ module DataCollector
18
18
  @listener.shutdown
19
19
  @running = false
20
20
  end
21
+ rescue Bunny::ConnectionAlreadyClosed => e
22
+ DataCollector::Core.log(e.message)
21
23
  rescue StandardError => e
22
24
  DataCollector::Core.error(e.message)
23
25
  end
@@ -28,8 +30,6 @@ module DataCollector
28
30
  DataCollector::Core.error(e.message)
29
31
  end
30
32
 
31
-
32
-
33
33
  def run(should_block = false, &block)
34
34
  @listener.subscribe(@bunny_queue) do |payload|
35
35
  payload = JSON.parse(payload)
@@ -17,6 +17,10 @@ module DataCollector
17
17
  @running = false
18
18
  @producer.shutdown
19
19
  end
20
+ rescue Bunny::ConnectionAlreadyClosed => e
21
+ DataCollector::Core.log(e.message)
22
+ rescue StandardError => e
23
+ DataCollector::Core.error(e.message)
20
24
  end
21
25
 
22
26
  private
@@ -182,7 +182,7 @@ module DataCollector
182
182
  raise "unable to save to file: #{e.message}"
183
183
  end
184
184
 
185
- def to_jsonfile (jsondata, jsonfile)
185
+ def to_jsonfile(jsondata, jsonfile)
186
186
  raise '[DEPRECATED] `to_jsonfile` deprecated. Please use `to_uri("file://abc.json", {template: "template.erb", content_type: "application/json"})` instead'
187
187
  rescue Exception => e
188
188
  raise "unable to save to jsonfile: #{e.message}"
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module DataCollector
3
- VERSION = "0.39.0"
3
+ VERSION = "0.41.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.0
4
+ version: 0.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-26 00:00:00.000000000 Z
11
+ date: 2023-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport