falcon 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/examples/sinatra/Gemfile.lock +7 -7
- data/examples/sinatra/config.ru +1 -1
- data/falcon.gemspec +1 -1
- data/lib/falcon/command.rb +14 -2
- data/lib/falcon/verbose.rb +10 -0
- data/lib/falcon/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 649afb10cb1c289a5cfe6d982514364c8390884ff41b82f96c8cd8f704ccd820
|
4
|
+
data.tar.gz: 98e3e690e776b90df7b41d3ccd1bcc7ca22a4dd1eb019840edded3a215c4da8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86ec7adc0c04b0bdbd0be2fc73f8def3e523de76188c1a2f2788659c226c34513d325f8e571c493506dad706753201392817c9692d643be61bfefd27f45cccf6
|
7
|
+
data.tar.gz: 20b36c690afdb98a5d619780fd4a04da43483d3aac31a3bd1265d25c367b894bb157833f505ebc04a063dd15c70bd354cb7c393e43f5ff3a752e17483cdb6e67
|
@@ -9,9 +9,9 @@ GEM
|
|
9
9
|
async-http (0.6.0)
|
10
10
|
async (~> 1.1)
|
11
11
|
async-io (~> 1.0)
|
12
|
-
async-io (1.
|
12
|
+
async-io (1.3.0)
|
13
13
|
async (~> 1.0)
|
14
|
-
falcon (0.6.
|
14
|
+
falcon (0.6.1)
|
15
15
|
async-container (~> 0.1)
|
16
16
|
async-http (~> 0.3)
|
17
17
|
async-io (~> 1.1)
|
@@ -19,10 +19,10 @@ GEM
|
|
19
19
|
samovar (~> 1.3)
|
20
20
|
hitimes (1.2.6)
|
21
21
|
mapping (1.1.1)
|
22
|
-
mustermann (1.0.
|
22
|
+
mustermann (1.0.2)
|
23
23
|
nio4r (2.2.0)
|
24
24
|
rack (2.0.4)
|
25
|
-
rack-protection (2.0.
|
25
|
+
rack-protection (2.0.1)
|
26
26
|
rack
|
27
27
|
rainbow (2.2.2)
|
28
28
|
rake
|
@@ -30,10 +30,10 @@ GEM
|
|
30
30
|
samovar (1.8.0)
|
31
31
|
mapping (~> 1.0)
|
32
32
|
rainbow (~> 2.0)
|
33
|
-
sinatra (2.0.
|
33
|
+
sinatra (2.0.1)
|
34
34
|
mustermann (~> 1.0)
|
35
35
|
rack (~> 2.0)
|
36
|
-
rack-protection (= 2.0.
|
36
|
+
rack-protection (= 2.0.1)
|
37
37
|
tilt (~> 2.0)
|
38
38
|
tilt (2.0.8)
|
39
39
|
timers (4.1.2)
|
@@ -47,4 +47,4 @@ DEPENDENCIES
|
|
47
47
|
sinatra
|
48
48
|
|
49
49
|
BUNDLED WITH
|
50
|
-
1.16.
|
50
|
+
1.16.1
|
data/examples/sinatra/config.ru
CHANGED
data/falcon.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency("async-io", "~> 1.
|
19
|
+
spec.add_dependency("async-io", "~> 1.3")
|
20
20
|
spec.add_dependency("async-http", "~> 0.3")
|
21
21
|
spec.add_dependency("async-container", "~> 0.1")
|
22
22
|
|
data/lib/falcon/command.rb
CHANGED
@@ -22,6 +22,7 @@ require_relative 'server'
|
|
22
22
|
require_relative 'verbose'
|
23
23
|
|
24
24
|
require 'async/container'
|
25
|
+
require 'async/io/trap'
|
25
26
|
|
26
27
|
require 'samovar'
|
27
28
|
require 'etc'
|
@@ -79,7 +80,18 @@ module Falcon
|
|
79
80
|
|
80
81
|
Async.logger.info "Falcon taking flight! Binding to #{@options[:bind]} [#{container_class} with concurrency: #{@options[:concurrency]}]"
|
81
82
|
|
82
|
-
|
83
|
+
debug_trap = Async::IO::Trap.new(:USR1)
|
84
|
+
|
85
|
+
container_class.new(concurrency: @options[:concurrency]) do |task|
|
86
|
+
task.async do
|
87
|
+
debug_trap.install!
|
88
|
+
Async.logger.info "Send `kill -USR1 #{Process.pid}` for detailed status :)"
|
89
|
+
|
90
|
+
debug_trap.trap do
|
91
|
+
task.reactor.print_hierarchy($stderr)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
83
95
|
server = Falcon::Server.new(app, [
|
84
96
|
Async::IO::Endpoint.parse(@options[:bind], reuse_port: true)
|
85
97
|
])
|
@@ -89,7 +101,7 @@ module Falcon
|
|
89
101
|
end
|
90
102
|
|
91
103
|
def invoke(parent)
|
92
|
-
run(
|
104
|
+
container = run(parent.verbose?)
|
93
105
|
|
94
106
|
sleep
|
95
107
|
end
|
data/lib/falcon/verbose.rb
CHANGED
@@ -27,6 +27,14 @@ module Falcon
|
|
27
27
|
@logger = logger
|
28
28
|
end
|
29
29
|
|
30
|
+
def annotate(env, task = Async::Task.current)
|
31
|
+
request_method = env['REQUEST_METHOD']
|
32
|
+
request_path = env['PATH_INFO']
|
33
|
+
remote_address = env['REMOTE_ADDR']
|
34
|
+
|
35
|
+
task.annotate("#{request_method} #{request_path} for #{remote_address}")
|
36
|
+
end
|
37
|
+
|
30
38
|
def log(start_time, env, response, error)
|
31
39
|
duration = Time.now - start_time
|
32
40
|
|
@@ -44,6 +52,8 @@ module Falcon
|
|
44
52
|
def call(env)
|
45
53
|
start_time = Time.now
|
46
54
|
|
55
|
+
annotate(env)
|
56
|
+
|
47
57
|
response = @app.call(env)
|
48
58
|
ensure
|
49
59
|
log(start_time, env, response, $!)
|
data/lib/falcon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-io
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: async-http
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
182
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.6
|
183
|
+
rubygems_version: 2.7.6
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: ''
|