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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c34a59f385757f96b63f7a7072fb377e72832a9c
4
- data.tar.gz: 614317654daa502e8521be52ffa7730b16068c29
2
+ SHA256:
3
+ metadata.gz: 649afb10cb1c289a5cfe6d982514364c8390884ff41b82f96c8cd8f704ccd820
4
+ data.tar.gz: 98e3e690e776b90df7b41d3ccd1bcc7ca22a4dd1eb019840edded3a215c4da8c
5
5
  SHA512:
6
- metadata.gz: 0fd5700a68dcba473e0f4c3e9e16dc77953609462749c2dbe14d8eed732e34911fc48821bde26508c868656415bfd08a2a08080e0866ef8ce5b55abf2e91097b
7
- data.tar.gz: b283f4fb9e3cd6d6e49a923e6a24470851e2f04ac3e4433d310884f9aa6b5302ae66d261a2196d37fcc79758b8f49f66a5e14db26c2b3867f3c643b0000ddf0a
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.2.1)
12
+ async-io (1.3.0)
13
13
  async (~> 1.0)
14
- falcon (0.6.0)
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.1)
22
+ mustermann (1.0.2)
23
23
  nio4r (2.2.0)
24
24
  rack (2.0.4)
25
- rack-protection (2.0.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.0)
33
+ sinatra (2.0.1)
34
34
  mustermann (~> 1.0)
35
35
  rack (~> 2.0)
36
- rack-protection (= 2.0.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.0
50
+ 1.16.1
@@ -6,7 +6,7 @@
6
6
  require 'sinatra/base'
7
7
  class MyApp < Sinatra::Base
8
8
  get "/" do
9
- "hello world"
9
+ response = Faraday.get 'http://sushi.com/nigiri/sake.json'
10
10
  end
11
11
  end
12
12
 
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.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
 
@@ -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
- container_class.new(concurrency: @options[:concurrency]) do
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(!parent.quiet?)
104
+ container = run(parent.verbose?)
93
105
 
94
106
  sleep
95
107
  end
@@ -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, $!)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.6.0"
22
+ VERSION = "0.7.0"
23
23
  end
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.6.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-02-13 00:00:00.000000000 Z
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.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.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.12
183
+ rubygems_version: 2.7.6
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: ''