pigato 0.2.20 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94c291fae6bd8790044648ba11cdec8c4c68b9f7
4
- data.tar.gz: ef9f41499f4194d117444d6d59a4c9f5ad7248ac
3
+ metadata.gz: a4b431470a5de2c818e705921433adf22d9a9802
4
+ data.tar.gz: 914cba2039a7b9ad871c841b026fccff65f4bdd6
5
5
  SHA512:
6
- metadata.gz: e727dc458f865bf1300b9fd3b352b80de2827dcd8863ec5b46f37e006fbda12d743cf2dc485d5ffacdeb930b5630361125d4b5dee467c9435298920a22ce14c0
7
- data.tar.gz: c9fa7de57e6653368f38a82474194c090b5d2a3ad87548531453315b3e4315ff901c964960ff8dce65e72980a2279e51b0261c191af59a28b6113f000c650de1
6
+ metadata.gz: 8a669ae249283032a15387b649cbe01fe3051059365961b553a6824becf10ed5730667fd5ba8b322dc3a09a1c13bc0063ea0e9d4feb8313e16b254fdfdcbdd22
7
+ data.tar.gz: 2afb4bceab5d06de1092995f918f87f6134ccba2a794630a4d2812f0e771e27e29dfa847105a3be54a4f6ae73ff580460ed2aac6594bff0a47a678e3143408b7
data/lib/pigato/client.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'thread'
2
2
 
3
+ $PIGATO_zmq_ctx = 0
4
+
3
5
  class Pigato::Client
4
6
 
5
7
  def initialize broker, conf = {}
@@ -25,7 +27,7 @@ class Pigato::Client
25
27
  end
26
28
 
27
29
  def get_thread_id
28
- tid = get_proc_id() + "|" + Thread.current.object_id.to_s
30
+ tid = "#" + get_proc_id() + "#" + Thread.current.object_id.to_s
29
31
  tid
30
32
  end
31
33
 
@@ -87,13 +89,11 @@ class Pigato::Client
87
89
 
88
90
  def reconnect_to_broker
89
91
  stop
90
- ctx = @ctxs[get_proc_id()]
91
- if ctx == nil
92
- ctx = ZMQ::Context.new
93
- ctx.linger = 0
94
- @ctxs[get_proc_id()] = ctx
92
+ if $PIGATO_zmq_ctx == nil
93
+ $PIGATO_zmq_ctx = ZMQ::Context.new
94
+ $PIGATO_zmq_ctx.linger = 0
95
95
  end
96
- socket = ctx.socket ZMQ::DEALER
96
+ socket = $PIGATO_zmq_ctx.socket ZMQ::DEALER
97
97
  socket.identity = SecureRandom.uuid
98
98
  socket.connect @broker
99
99
  @sockets[get_thread_id()] = socket
@@ -1,3 +1,3 @@
1
1
  module Pigato
2
- VERSION = "0.2.20"
2
+ VERSION = "0.2.21"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.20
4
+ version: 0.2.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Ardoino