pixo 0.4.0 → 0.4.1
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/pixo.rb +6 -0
- data/lib/pixo/application.rb +1 -3
- data/lib/pixo/renderer.rb +5 -1
- data/lib/pixo/rpc/request_types.rb +1 -1
- data/lib/pixo/rpc/service.rb +20 -11
- data/lib/pixo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49c00d86d98cb6be43ae290175313ee7af4b6e5
|
4
|
+
data.tar.gz: 40a9255fa51834283531d73a43ecfe8130564a6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6196ff2ea3adbfe98a206cd28692b3ffaa9bb600adc91351eda36ba24372a74818c81ea551add51ed7d7ca5070689700a0bf12e7734b78950a9451ea36e89ad
|
7
|
+
data.tar.gz: acb04c4a13e8fa2ad1b2101717f3011f59bf6344ff7f3a17dfb59abad7303c6942f2c807d467ec3cab8fc0050d75961c20ae323aca5ba910394dcebf57616f09
|
data/Gemfile.lock
CHANGED
data/lib/pixo.rb
CHANGED
data/lib/pixo/application.rb
CHANGED
@@ -10,7 +10,7 @@ module Pixo
|
|
10
10
|
|
11
11
|
def initialize()
|
12
12
|
super
|
13
|
-
@procs = Array.new
|
13
|
+
@procs = Concurrent::Array.new
|
14
14
|
|
15
15
|
@procs_lock = Mutex.new
|
16
16
|
@started_latch = Concurrent::CountDownLatch.new(1)
|
@@ -68,8 +68,6 @@ module Pixo
|
|
68
68
|
pat.reset_start
|
69
69
|
@active_pattern = pat
|
70
70
|
end
|
71
|
-
|
72
|
-
pattern
|
73
71
|
end
|
74
72
|
|
75
73
|
def pattern
|
data/lib/pixo/renderer.rb
CHANGED
data/lib/pixo/rpc/service.rb
CHANGED
@@ -20,12 +20,13 @@ module Pixo::Rpc
|
|
20
20
|
message = Marshal.load(Base64.strict_decode64(line.strip))
|
21
21
|
if message.is_a?(Pixo::Rpc::RequestMessage)
|
22
22
|
resp = Pixo::Rpc::ResponseMessage.new(message.data.call(self), message.rid)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
unless message.async
|
24
|
+
bytes_to_write = Base64.strict_encode64(Marshal.dump(resp))
|
25
|
+
@pipe_mutex.synchronize do
|
26
|
+
@writer_pipe.write(bytes_to_write)
|
27
|
+
@writer_pipe.write($/)
|
28
|
+
@writer_pipe.flush
|
29
|
+
end
|
29
30
|
end
|
30
31
|
elsif message.is_a?(Pixo::Rpc::ResponseMessage)
|
31
32
|
@live_requests[message.rid]
|
@@ -35,6 +36,9 @@ module Pixo::Rpc
|
|
35
36
|
end
|
36
37
|
rescue EOFError => e
|
37
38
|
rescue IOError => e
|
39
|
+
rescue
|
40
|
+
STDERR.puts("RUN: #{$!}")
|
41
|
+
$!.backtrace.each do |back| STDERR.puts(back) end
|
38
42
|
end
|
39
43
|
|
40
44
|
def shutdown
|
@@ -44,7 +48,7 @@ module Pixo::Rpc
|
|
44
48
|
end
|
45
49
|
|
46
50
|
def request(message, timeout: 10, async: false)
|
47
|
-
request = Pixo::Rpc::Request.new(message)
|
51
|
+
request = Pixo::Rpc::Request.new(message, async)
|
48
52
|
@live_requests[request.message.rid] = request unless async
|
49
53
|
|
50
54
|
bytes_to_write = Base64.strict_encode64(Marshal.dump(request.message))
|
@@ -61,6 +65,9 @@ module Pixo::Rpc
|
|
61
65
|
end
|
62
66
|
|
63
67
|
return request.response
|
68
|
+
rescue
|
69
|
+
STDERR.puts "request: #{$!.inspect}"
|
70
|
+
raise
|
64
71
|
ensure
|
65
72
|
@live_requests.delete request.message.rid
|
66
73
|
end
|
@@ -76,10 +83,10 @@ module Pixo::Rpc
|
|
76
83
|
attr_reader :response
|
77
84
|
attr_reader :latch
|
78
85
|
|
79
|
-
def initialize(data)
|
80
|
-
@message = Pixo::Rpc::RequestMessage.new(data)
|
86
|
+
def initialize(data, async)
|
87
|
+
@message = Pixo::Rpc::RequestMessage.new(data, async)
|
81
88
|
|
82
|
-
@latch = Concurrent::CountDownLatch.new(1)
|
89
|
+
@latch = Concurrent::CountDownLatch.new(1) unless async
|
83
90
|
end
|
84
91
|
|
85
92
|
def send_result(result)
|
@@ -98,9 +105,11 @@ module Pixo::Rpc
|
|
98
105
|
end
|
99
106
|
|
100
107
|
class RequestMessage < Message
|
101
|
-
|
108
|
+
attr_reader :async
|
109
|
+
def initialize(data, async)
|
102
110
|
super(data)
|
103
111
|
@rid = "rid_#{SecureRandom.hex(10)}"
|
112
|
+
@async = async
|
104
113
|
end
|
105
114
|
end
|
106
115
|
|
data/lib/pixo/version.rb
CHANGED