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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/basicjrpc.rb +15 -2
- data/lib/basicjrpc/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: 1f7673862bf3d477490d8e0bb363f57acaaec64a
|
4
|
+
data.tar.gz: 86201075e588c948c495195401c4059bfae11a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4980cb830fa995a396682747afda25bc1aa585eca130991fffbf05bbbf1f18870b3b06618c789a3c651f76b3efc137f4b70a9227f22b9d6cabf246005a77222
|
7
|
+
data.tar.gz: 765fcb893bdda31f88247cc2c7f5b5a2a4d5eec230cfa320aa797d96d0e08789119ba47b87a736a999b75df9d03c176d52faa5bffcccffff8825c1c840af4508
|
data/Gemfile.lock
CHANGED
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
|
-
|
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)
|
data/lib/basicjrpc/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|