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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mqtt/sub_handler.rb +14 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e09d59deb9258997fe1da980c6829a8a8a46bdc
4
- data.tar.gz: a1c0f844c2c1091264b76ce512ce7c3ec0d2208c
3
+ metadata.gz: 18671e62878aafdf463e797c5e89da3ea1c20929
4
+ data.tar.gz: a3d320eb0eb210c1e5826d54e9b835a5cf9b7faf
5
5
  SHA512:
6
- metadata.gz: d9a99a82f2d2f83c088ddf25230db211796a1b6f435f976052fc6f5075d79eadf3ccbc4d6bf78b797a388ecd6f8aece4cde3e88152d40b50f1d897d8f65166e3
7
- data.tar.gz: d0412d540d2b44a00879b1965b9bc46301d2d716135229fb43d5fbf84565d664488993ec9177836b5ad2b23ca8160f22dceeda23b8f6749809d45707101ca290
6
+ metadata.gz: f4a469aa5608c1283ff0daf5e5946086b1ed249052aa12d1284264a450d12b6e30cc217241cd0b582002d7f5ae26c5ad4ff3a0a58b83d843b6765522b5155f11
7
+ data.tar.gz: f2fb74a355bdf2079381fec5278d76ebf7b55f38d339df0d14735041448b55bfbcadc8754d67fa5c9ea45c4af0fe08505ae79586b4f7cf1ea468aa6272d16d59
@@ -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
- Timeout.timeout(3) {
71
- h.offer(tMatch, data)
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.3
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-31 00:00:00.000000000 Z
11
+ date: 2019-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mqtt