pigato 0.2.0 → 0.2.1
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 +4 -4
- data/examples/echo_client.rb +1 -1
- data/lib/pigato/client.rb +14 -4
- data/lib/pigato/version.rb +1 -1
- 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: cf42b9ee09f4f2d044a205392c259d2532ca814a
|
4
|
+
data.tar.gz: bca843c87ada09476d84d73302511193e192b378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4378e46841c525850f428c01000b2f3f02a50e1a2587edec105cf2ee3c9376b37d0aa8a9d9a7c00a4fdeadced8fe71984d46e169ac05e0c5547623d33cb44b
|
7
|
+
data.tar.gz: d680305a50369e71b72db8714d1dd23d3528789ca107e61a5d55a7b22473b6f30506c0f336e90ca707aa358bcee3d0390698b29c45491f4ae324a340a7de0ad0
|
data/examples/echo_client.rb
CHANGED
@@ -4,7 +4,7 @@ require "rubygems"
|
|
4
4
|
require "#{File.dirname(__FILE__)}/../lib/pigato.rb"
|
5
5
|
#require "pigato"
|
6
6
|
|
7
|
-
client = Pigato::Client.new('tcp://localhost:55555')
|
7
|
+
client = Pigato::Client.new('tcp://localhost:55555', { :autostart => true })
|
8
8
|
requests = 1000
|
9
9
|
d1 = Time.now
|
10
10
|
requests.times do |i|
|
data/lib/pigato/client.rb
CHANGED
@@ -3,17 +3,27 @@ require "securerandom"
|
|
3
3
|
|
4
4
|
class Pigato::Client
|
5
5
|
|
6
|
-
def initialize broker
|
6
|
+
def initialize broker, conf = {}
|
7
7
|
@broker = broker
|
8
8
|
@context = ZMQ::Context.new(1)
|
9
9
|
@socket = nil
|
10
10
|
@poller = ZMQ::Poller.new
|
11
|
-
@timeout = 2500
|
12
11
|
|
13
|
-
|
12
|
+
@conf = {
|
13
|
+
:autostart => false,
|
14
|
+
:timeout => 2500
|
15
|
+
}
|
16
|
+
|
17
|
+
@conf.merge!(conf)
|
18
|
+
|
19
|
+
if @conf[:autostart]
|
20
|
+
start
|
21
|
+
end
|
14
22
|
end
|
15
23
|
|
16
|
-
def request service, request, timeout = @timeout
|
24
|
+
def request service, request, timeout = @conf[:timeout]
|
25
|
+
return nil if @socket == nil;
|
26
|
+
|
17
27
|
request = [Oj.dump(request)]
|
18
28
|
|
19
29
|
rid = SecureRandom.uuid
|
data/lib/pigato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pigato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Ardoino
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|