basicjrpc 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b533ebb3c51db3ecd64f248fcaf2b4d9485b701
4
- data.tar.gz: f7262e30c8ebbc523f61866619cc3248d210074f
3
+ metadata.gz: 1f7673862bf3d477490d8e0bb363f57acaaec64a
4
+ data.tar.gz: 86201075e588c948c495195401c4059bfae11a24
5
5
  SHA512:
6
- metadata.gz: 8f834a596de9506b6d46724ff73f8425fb0aef2dc4e181dced1cf29444b4e2b55386d4b95e377139ceaffd14f41b57e01b0dad0ae28b80219a14f41c878ef6ff
7
- data.tar.gz: 3d1d6a3667faf395166acb4fd9a2327353faa7247144bf76fe8c633da0a5166419057f8f019358b26865dae37b186117f450fe60c85280d6d441f528bf01b0fe
6
+ metadata.gz: d4980cb830fa995a396682747afda25bc1aa585eca130991fffbf05bbbf1f18870b3b06618c789a3c651f76b3efc137f4b70a9227f22b9d6cabf246005a77222
7
+ data.tar.gz: 765fcb893bdda31f88247cc2c7f5b5a2a4d5eec230cfa320aa797d96d0e08789119ba47b87a736a999b75df9d03c176d52faa5bffcccffff8825c1c840af4508
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- basicjrpc (0.1.0)
4
+ basicjrpc (0.1.5)
5
5
  oj
6
6
  redis
7
7
 
data/lib/basicjrpc.rb CHANGED
@@ -4,6 +4,16 @@ require 'oj'
4
4
  require 'securerandom'
5
5
 
6
6
  module BasicJRPC
7
+ class Config
8
+ def set_debug val
9
+ @@debug = val
10
+ end
11
+
12
+ def debug
13
+ @@debug || false
14
+ end
15
+ end
16
+
7
17
  class Client
8
18
 
9
19
  class Payload
@@ -28,7 +38,10 @@ module BasicJRPC
28
38
 
29
39
  def send_request payload
30
40
  @redis.rpush(@queue, Oj.dump(payload))
31
- Oj.load(@redis.blpop(payload.message_id)[1])
41
+
42
+ Timeout::timeout(5) {
43
+ return Oj.load(@redis.blpop(payload.message_id)[1])
44
+ }
32
45
  end
33
46
  end
34
47
 
@@ -45,7 +58,7 @@ module BasicJRPC
45
58
  while true
46
59
  payload = @redis.blpop(@queue)[1]
47
60
  payload = Oj.load(payload)
48
- puts "Processing message #{payload}"
61
+ puts "Processing message #{payload.method_name} #{payload.args}" if BasicJRPC::Config.debug
49
62
 
50
63
  # Should always return a data object
51
64
  response = @injected_class.send(payload.method_name, *payload.args)
@@ -1,3 +1,3 @@
1
1
  module BasicJRPC
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basicjrpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Simpson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-23 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler