bmc-daemon-lib 0.3.14 → 0.3.16
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/bmc-daemon-lib.gemspec +1 -1
- data/lib/bmc-daemon-lib.rb +1 -0
- data/lib/bmc-daemon-lib/logger_pool.rb +1 -0
- data/lib/bmc-daemon-lib/mq_consumer.rb +19 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979aa39471d0f78ea2463c44e0471def495dbfc9
|
4
|
+
data.tar.gz: 3fab11319297f7f7c77c1cb2b6056cf72f492856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c005bc13c44b365c8b207e12412ff710c0605dfbf0685ec5962c8c620c27fa37d633c2f3f3f7ced7c251a9f2d37dd7214c1d8de2bf64a1c7a3f661d498930ce
|
7
|
+
data.tar.gz: 2a2813cd028bbfd6d656aca6f33bf6d1be415032dc75f16e35f2a16fa93c1eccd1f2f17961935b5f17afc5240acc693acd85e22772b294393c375f1e4e99ae84
|
data/Gemfile.lock
CHANGED
data/bmc-daemon-lib.gemspec
CHANGED
data/lib/bmc-daemon-lib.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
1
3
|
module BmcDaemonLib
|
2
4
|
class MqConsumerError < StandardError; end
|
5
|
+
class MqConsumerException < StandardError; end
|
3
6
|
|
4
7
|
class MqConsumer < MqEndpoint
|
5
8
|
|
@@ -56,6 +59,12 @@ module BmcDaemonLib
|
|
56
59
|
rkey: msg_rkey,
|
57
60
|
tag: msg_tag,
|
58
61
|
data: msg_data
|
62
|
+
|
63
|
+
# Handle errors
|
64
|
+
rescue StandardError => e
|
65
|
+
#puts "handle_receive: exception: #{e.inspect}"
|
66
|
+
log_error "UNEXPECTED EXCEPTION: #{e.inspect}"
|
67
|
+
raise MqConsumerException, e.message
|
59
68
|
end
|
60
69
|
|
61
70
|
def consumer_cancelled all={}
|
@@ -63,15 +72,19 @@ module BmcDaemonLib
|
|
63
72
|
end
|
64
73
|
|
65
74
|
def extract_delay msg_headers
|
66
|
-
|
75
|
+
sent_at = msg_headers['sent_at'].to_s
|
76
|
+
return if sent_at.empty?
|
67
77
|
|
68
78
|
# Extract sent_at header
|
69
|
-
sent_at = Time.
|
70
|
-
|
71
|
-
|
79
|
+
sent_at = Time.parse(msg_headers['sent_at'])
|
80
|
+
|
81
|
+
rescue StandardError => ex
|
82
|
+
log_error "extract_delay: can't parse sent_at [#{sent_at}] (#{ex.message})"
|
83
|
+
return nil
|
72
84
|
|
73
|
-
|
74
|
-
|
85
|
+
else
|
86
|
+
# Compute delay
|
87
|
+
return ((Time.now - sent_at)*1000).round(2)
|
75
88
|
end
|
76
89
|
|
77
90
|
def handle_message context, metadata, delivery_info, message = {}
|