mqtt-sub_handler 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mqtt/sub_handler.rb +14 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18671e62878aafdf463e797c5e89da3ea1c20929
|
4
|
+
data.tar.gz: a3d320eb0eb210c1e5826d54e9b835a5cf9b7faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4a469aa5608c1283ff0daf5e5946086b1ed249052aa12d1284264a450d12b6e30cc217241cd0b582002d7f5ae26c5ad4ff3a0a58b83d843b6765522b5155f11
|
7
|
+
data.tar.gz: f2fb74a355bdf2079381fec5278d76ebf7b55f38d339df0d14735041448b55bfbcadc8754d67fa5c9ea45c4af0fe08505ae79586b4f7cf1ea468aa6272d16d59
|
data/lib/mqtt/sub_handler.rb
CHANGED
@@ -67,9 +67,13 @@ class SubHandler
|
|
67
67
|
@callbackList.each do |h|
|
68
68
|
tMatch = SubHandler.getTopicMatch(topic, h.topic_split);
|
69
69
|
if tMatch
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
begin
|
71
|
+
Timeout.timeout(10) {
|
72
|
+
h.offer(tMatch, data)
|
73
|
+
}
|
74
|
+
rescue Timeout::Error
|
75
|
+
STDERR.puts "MQTT Callback Timeout #{h}"
|
76
|
+
end
|
73
77
|
topicHasReceivers = true;
|
74
78
|
end
|
75
79
|
end
|
@@ -216,6 +220,7 @@ class SubHandler
|
|
216
220
|
data = data.to_json
|
217
221
|
end
|
218
222
|
|
223
|
+
retryCount = 0;
|
219
224
|
begin
|
220
225
|
@conChangeMutex.lock
|
221
226
|
if not @connected
|
@@ -226,6 +231,12 @@ class SubHandler
|
|
226
231
|
@mqtt.publish(topic, data, retain);
|
227
232
|
end
|
228
233
|
rescue MQTT::Exception, SocketError, SystemCallError
|
234
|
+
retryCount += 1;
|
235
|
+
if(qos == 0 && retryCount == 3)
|
236
|
+
STDERR.puts "Publish to #{topic} dropped!"
|
237
|
+
return;
|
238
|
+
end
|
239
|
+
|
229
240
|
sleep 0.05;
|
230
241
|
retry
|
231
242
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mqtt-sub_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xasin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01
|
11
|
+
date: 2019-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mqtt
|