zapp 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zapp/pipe.rb +14 -0
- data/lib/zapp/server.rb +2 -2
- data/lib/zapp/version.rb +1 -1
- data/lib/zapp/worker/request_processor.rb +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e94e39ad73864691347e3eac33c5e28b4d08e62fdbc18bfa9f1c5fa72000ef3
|
4
|
+
data.tar.gz: f78eadb3fe3f7368121082a5d3fc4449de5d39fba61a3ddb6e39f638c6baded9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 625301dd7456472bb96afc272bdff5e5d7295e95b8e6e17bf5a1d91dc82eda8af0d96bd009d42407e957b27a84a6ee49c319a3b1b273dfe8c92bea4c42a9fe82
|
7
|
+
data.tar.gz: 43e2b8ad39bc78660d94b5ef1ca09258f8fdf076a6cd571793225e9dd3880831eb50ab8a0c036068220dfe83bb061ce0da08a9ceb2a6244fcba218520e99dde2
|
data/lib/zapp/pipe.rb
CHANGED
@@ -3,6 +3,20 @@
|
|
3
3
|
module Zapp
|
4
4
|
# Light wrapper around a Ractor for piping messages CSP style
|
5
5
|
class Pipe < Ractor
|
6
|
+
def self.for(*klasses, null: true)
|
7
|
+
Ractor.new(klasses, null) do |klasses, null|
|
8
|
+
loop do
|
9
|
+
Ractor.yield(
|
10
|
+
Ractor.receive_if do |msg|
|
11
|
+
return true if null && msg.nil?
|
12
|
+
|
13
|
+
klasses.any? { |klass| msg.is_a?(klass) }
|
14
|
+
end
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
def self.new
|
7
21
|
super do
|
8
22
|
loop do
|
data/lib/zapp/server.rb
CHANGED
@@ -9,8 +9,8 @@ module Zapp
|
|
9
9
|
# Ensure config.ru file is loaded just once by main ractor
|
10
10
|
Zapp.config.app
|
11
11
|
|
12
|
-
@socket_pipe = Zapp::Pipe.
|
13
|
-
@context_pipe = Zapp::Pipe.
|
12
|
+
@socket_pipe = Zapp::Pipe.for(TCPSocket)
|
13
|
+
@context_pipe = Zapp::Pipe.for(Zapp::HTTPContext::Context, Symbol)
|
14
14
|
|
15
15
|
@socket_pipe_receiver = Zapp::SocketPipe::Receiver.new(pipe: @socket_pipe)
|
16
16
|
|
data/lib/zapp/version.rb
CHANGED
@@ -13,11 +13,16 @@ module Zapp
|
|
13
13
|
|
14
14
|
def loop
|
15
15
|
while (context = context_pipe.take)
|
16
|
-
if context
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
if context.is_a?(Symbol)
|
17
|
+
if context == Zapp::WorkerPool::SIGNALS[:EXIT]
|
18
|
+
Zapp::Logger.trace("Received exit signal, shutting down")
|
19
|
+
shutdown
|
20
|
+
break
|
21
|
+
else
|
22
|
+
next
|
23
|
+
end
|
20
24
|
end
|
25
|
+
|
21
26
|
|
22
27
|
process = lambda {
|
23
28
|
process(context: context)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias H Steffensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|