falcon 0.34.3 → 0.34.4

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
2
  SHA256:
3
- metadata.gz: ab5e0190fc53293e70feae142083e0485e2de94c9898b1723bc707ba00fc7ffa
4
- data.tar.gz: 26184cc3d3816d43cdeb375d4a0057b0d52c128a0febe4c8724de1cf4a85449f
3
+ metadata.gz: 36eedcd95d634d7932afa71585259c9cdce1826784b9803b9677c11080f674a1
4
+ data.tar.gz: 172c9c7a90cfb1fe113c9671e8b3e3b7ef91b3deaedb8c034e862880eeaaadb7
5
5
  SHA512:
6
- metadata.gz: dbf2ef731d8a70da42014fe278139ed7b6e4cf06e367d44173bf232ed8d122666afd1428773db72dec098434f03391b4ab1aaf7bfa516fa41c3b9409fc014362
7
- data.tar.gz: d573a2979a1f182fd42b4026863f21e1c8c19b81faab0f68c8393c232ecf52b2d9a89c080e105f24d79dee16e8213f481a6ce9df3fd3129b6ec98751b488682b
6
+ metadata.gz: 6df4a5606f0616d33b54874d4235360e19cd8a3be22172be045baa3cd29b4948b4c97b37c52da2ae81c4294423906a0a93abb384fc01d37096d67befd4a62f9c
7
+ data.tar.gz: 59ef087e02bc950e08b1dc7645481a8b16f4743e64446a9cfdbf002660978d340273e5e3b7228ece9979862ebf37fd781fafc2270c7af6ce9e3388a43318d1be
@@ -1,2 +1,3 @@
1
1
  # These are supported funding model platforms
2
2
  custom: https://github.com/socketry/community/#funding
3
+ github: ioquatix
data/README.md CHANGED
@@ -4,7 +4,7 @@ Falcon is a multi-process, multi-fiber rack-compatible HTTP server built on top
4
4
 
5
5
  [Priority Business Support](#priority-business-support) is available.
6
6
 
7
- [![Build Status](https://travis-ci.com/socketry/falcon.svg)](http://travis-ci.com/socketry/falcon)
7
+ [![Build Status](https://travis-ci.com/socketry/falcon.svg?branch=master)](https://travis-ci.com/socketry/falcon)
8
8
  [![Code Climate](https://codeclimate.com/github/socketry/falcon.svg)](https://codeclimate.com/github/socketry/falcon)
9
9
  [![Coverage Status](https://coveralls.io/repos/socketry/falcon/badge.svg)](https://coveralls.io/r/socketry/falcon)
10
10
  [![Gitter](https://badges.gitter.im/join.svg)](https://gitter.im/socketry/falcon)
@@ -252,6 +252,16 @@ Falcon uses a pre-fork model which loads the entire rack application before fork
252
252
 
253
253
  [async-http] has been designed carefully to minimize IO related garbage. This avoids large per-request memory allocations or disk usage, provided that you use streaming IO.
254
254
 
255
+ ### System Limitations
256
+
257
+ If you are expecting to handle many simultaneous connections, please ensure you configure your file limits correctly.
258
+
259
+ ```
260
+ Errno::EMFILE: Too many open files - accept(2)
261
+ ```
262
+
263
+ This means that your system is limiting the number of files that can be opened by falcon. Please check the `ulimit` of your system and set it appropriately.
264
+
255
265
  ## Priority Business Support
256
266
 
257
267
  Falcon can be an important part of your business or project, both improving performance and saving money. As such, priority business support is available to make every project a success. The agreement will give you:
@@ -0,0 +1,53 @@
1
+
2
+ require 'async'
3
+ require 'async/http/internet'
4
+
5
+ # Experimental.
6
+ require 'kernel/sync'
7
+
8
+ class Search
9
+ def initialize(app)
10
+ @internet = Async::HTTP::Internet.new
11
+
12
+ @app = app
13
+ end
14
+
15
+ # This method uses the `Async` method to create a reactor if required, and then executes the contained code without waiting for the result. So even if the search query takes a long time (e.g. 100ms), it won't hold up the request processing.
16
+ def async(close: !Async::Task.current?)
17
+ Async do
18
+ response = @internet.get("https://google.com/search?q=async+ruby")
19
+
20
+ puts response.inspect
21
+ ensure
22
+ response&.finish
23
+ end
24
+ end
25
+
26
+ # This method uses the experimental `Sync` method to create a reactor if required. If the code is already running in a reactor, it runs synchronously, otherwise it's effectively the same as `Async` and a blocking operation. This allow you to write efficient non-blocking code that works in both traditional web application servers, but gains additional scalability in `Async`-aware servers like Falcon.
27
+ # You can achieve a similar result by calling `Async{}.wait`, but this is less efficient as it will allocate a sub-task even thought it's not needed.
28
+ def sync(close: !Async::Task.current?)
29
+ Sync do
30
+ response = @internet.get("https://google.com/search?q=async+ruby")
31
+
32
+ puts response.inspect
33
+ ensure
34
+ response&.finish
35
+ end
36
+ end
37
+
38
+ # The only point of this is to invoke one of the above two methods.
39
+ def call(env)
40
+ case env['PATH_INFO']
41
+ when '/sync'
42
+ self.sync
43
+ when '/async'
44
+ self.async
45
+ end
46
+
47
+ return @app.call(env)
48
+ end
49
+ end
50
+
51
+ use Search
52
+
53
+ run lambda{|env| [404, [], []]}
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "async", "~> 1.13"
23
23
  spec.add_dependency "async-io", "~> 1.22"
24
- spec.add_dependency "async-http", "~> 0.48.0"
24
+ spec.add_dependency "async-http", "~> 0.49.0"
25
25
  spec.add_dependency "async-container", "~> 0.14.0"
26
26
 
27
27
  spec.add_dependency "rack", ">= 1.0"
@@ -32,6 +32,8 @@ require 'samovar'
32
32
  require 'rack/builder'
33
33
  require 'rack/server'
34
34
 
35
+ require 'bundler'
36
+
35
37
  module Falcon
36
38
  module Command
37
39
  class Serve < Samovar::Command
@@ -45,6 +47,7 @@ module Falcon
45
47
  option '-t/--timeout <duration>', "Specify the maximum time to wait for blocking operations.", type: Float, default: nil
46
48
 
47
49
  option '-c/--config <path>', "Rackup configuration file to load", default: 'config.ru'
50
+ option '--preload', "Preload the bundle before creating containers"
48
51
 
49
52
  option '--forked | --threaded | --hybrid', "Select a specific parallelism model", key: :container, default: :forked
50
53
 
@@ -101,7 +104,9 @@ module Falcon
101
104
  end
102
105
 
103
106
  def run(verbose = false)
104
- app, _ = load_app(verbose)
107
+ if @options[:preload]
108
+ Bundler.require(:preload)
109
+ end
105
110
 
106
111
  endpoint = Endpoint.parse(@options[:bind], **endpoint_options)
107
112
 
@@ -138,6 +143,8 @@ module Falcon
138
143
  end
139
144
  end
140
145
 
146
+ app, _ = load_app(verbose)
147
+
141
148
  server = Falcon::Server.new(app, bound_endpoint, endpoint.protocol, endpoint.scheme)
142
149
 
143
150
  server.run
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.34.3"
22
+ VERSION = "0.34.4"
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.34.3
4
+ version: 0.34.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-16 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.48.0
47
+ version: 0.49.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.48.0
54
+ version: 0.49.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: async-container
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +247,7 @@ files:
247
247
  - examples/csv/config.ru
248
248
  - examples/hello/config.ru
249
249
  - examples/hello/falcon.rb
250
+ - examples/internet/config.ru
250
251
  - examples/push/client.rb
251
252
  - examples/push/config.ru
252
253
  - examples/push/index.html
@@ -316,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
317
  - !ruby/object:Gem::Version
317
318
  version: '0'
318
319
  requirements: []
319
- rubygems_version: 3.0.4
320
+ rubygems_version: 3.0.6
320
321
  signing_key:
321
322
  specification_version: 4
322
323
  summary: A fast, asynchronous, rack-compatible web server.