falcon 0.52.3 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f0eb04a60a0e8100f830405fc1a55fa3cc1a31f8b8ad76922aba21c8bfc6796
4
- data.tar.gz: 9491638bdf672c83ad490af7e192dabc903d5743061fa4fa95228f8fe195e772
3
+ metadata.gz: 7a29bc2c8b56a674c1dd385f9655d454d0c792ee1c09c512cfc2019c265c3f17
4
+ data.tar.gz: 3a195cf6d478834756980f39ccc580d879b0b38a6272837aa51322dad8bd0cc4
5
5
  SHA512:
6
- metadata.gz: d4068f413136896989dabcf1642040a2dfc118176968aa91b249cfecf055801823df0f40912b774008c99ac2e2a87b178e842d54368458c0d6595ad8dcc36f6c
7
- data.tar.gz: 1078328b527bfd6ec35041dfbd9e542d0b0a2c0018850bdf447ad6160d190ee9ad876d64b222b4dec571b8f56f2550c26a171190e0c8f060fd4a959b236089d0
6
+ metadata.gz: 7e9ec3a6e57f6768125efb73f99fbed1918f94665ba1635b89706fd5ca14ab074c4bcfa090f7dc290f2732142f27d94afff597a239ffcc36ce02b24278ff3a4f
7
+ data.tar.gz: e01aae910c60cb9bacf01949c784cedce9ecd4bd5b23c47544a0da0d347fce01a9394d9f0232abec1ed90e4f5de4a924bcf7d97c3ee81b4d569bb609292d3546
checksums.yaml.gz.sig CHANGED
Binary file
@@ -9,7 +9,7 @@ Falcon supports WebSockets using the [async-websocket gem](https://github.com/so
9
9
  ~~~ruby
10
10
  # config.ru
11
11
 
12
- require "async/websocket/adapter/rack"
12
+ require "async/websocket/adapters/rack"
13
13
 
14
14
  run do |env|
15
15
  Async::WebSocket::Adapters::Rack.open(env, protocols: ['ws']) do |connection|
@@ -64,7 +64,6 @@ module Falcon
64
64
  def environment
65
65
  Async::Service::Environment.new(Falcon::Environment::Server).with(
66
66
  Falcon::Environment::Rackup,
67
-
68
67
  root: Dir.pwd,
69
68
 
70
69
  verbose: self.parent&.verbose?,
@@ -73,7 +73,7 @@ module Falcon
73
73
  merge(:supervisor, name: name, root: @root, &block)
74
74
  )
75
75
  end
76
-
76
+
77
77
  private
78
78
 
79
79
  # Build a new environment with the specified name and the given parents.
@@ -3,7 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020-2025, by Samuel Williams.
5
5
 
6
- require "async/service/generic"
6
+ require "async/service/managed_environment"
7
7
  require "async/http/endpoint"
8
8
 
9
9
  require_relative "../service/server"
@@ -13,6 +13,8 @@ module Falcon
13
13
  module Environment
14
14
  # Provides an environment for hosting a web application that uses a Falcon server.
15
15
  module Server
16
+ include Async::Service::ManagedEnvironment
17
+
16
18
  # The service class to use for the proxy.
17
19
  # @returns [Class]
18
20
  def service_class
@@ -25,21 +27,6 @@ module Falcon
25
27
  self.name
26
28
  end
27
29
 
28
- # Number of instances to start. By default (when nil), uses `Etc.nprocessors`.
29
- # @returns [Integer | nil]
30
- def count
31
- nil
32
- end
33
-
34
- # Options to use when creating the container.
35
- def container_options
36
- {
37
- restart: true,
38
- count: self.count,
39
- health_check_timeout: 30,
40
- }.compact
41
- end
42
-
43
30
  # The host that this server will receive connections for.
44
31
  def url
45
32
  "http://[::]:9292"
@@ -80,13 +67,6 @@ module Falcon
80
67
  ::Async::HTTP::Endpoint.parse(url)
81
68
  end
82
69
 
83
- # Any scripts to preload before starting the server.
84
- #
85
- # @returns [Array(String)] The list of scripts to preload.
86
- def preload
87
- []
88
- end
89
-
90
70
  # Make a server instance using the given endpoint. The endpoint may be a bound endpoint, so we take care to specify the protocol and scheme as per the original endpoint.
91
71
  #
92
72
  # @parameter endpoint [IO::Endpoint] The endpoint to bind to.
@@ -56,10 +56,10 @@ module Falcon
56
56
  # # An endpoint suitable for connecting to the specified hostname.
57
57
  # def host_endpoint(hostname, **options)
58
58
  # endpoint = secure_endpoint(**options)
59
-
59
+ #
60
60
  # url = URI.parse(bind_secure)
61
61
  # url.hostname = hostname
62
-
62
+ #
63
63
  # return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname)
64
64
  # end
65
65
  end
@@ -4,7 +4,7 @@
4
4
  # Copyright, 2019-2025, by Samuel Williams.
5
5
  # Copyright, 2020, by Daniel Evans.
6
6
 
7
- require "async/service/generic"
7
+ require "async/service/managed_service"
8
8
  require "async/container/supervisor/supervised"
9
9
  require "async/http/endpoint"
10
10
 
@@ -12,28 +12,13 @@ require_relative "../server"
12
12
 
13
13
  module Falcon
14
14
  module Service
15
- class Server < Async::Service::Generic
15
+ class Server < Async::Service::ManagedService
16
16
  def initialize(...)
17
17
  super
18
18
 
19
19
  @bound_endpoint = nil
20
20
  end
21
21
 
22
- # Preload any resources specified by the environment.
23
- def preload!
24
- root = @evaluator.root
25
-
26
- if scripts = @evaluator.preload
27
- scripts = Array(scripts)
28
-
29
- scripts.each do |path|
30
- Console.logger.info(self) {"Preloading #{path}..."}
31
- full_path = File.expand_path(path, root)
32
- load(full_path)
33
- end
34
- end
35
- end
36
-
37
22
  # Prepare the bound endpoint for the server.
38
23
  def start
39
24
  @endpoint = @evaluator.endpoint
@@ -42,47 +27,42 @@ module Falcon
42
27
  @bound_endpoint = @endpoint.bound
43
28
  end
44
29
 
45
- preload!
46
-
47
30
  Console.logger.info(self) {"Starting #{self.name} on #{@endpoint}"}
48
31
 
49
32
  super
50
33
  end
51
34
 
52
- # Setup the container with the application instance.
53
- # @parameter container [Async::Container::Generic]
54
- def setup(container)
55
- container_options = @evaluator.container_options
56
- health_check_timeout = container_options[:health_check_timeout]
35
+ # Run the service logic.
36
+ #
37
+ # @parameter instance [Object] The container instance.
38
+ # @parameter evaluator [Environment::Evaluator] The environment evaluator.
39
+ # @returns [Falcon::Server] The server instance.
40
+ def run(instance, evaluator)
41
+ if evaluator.key?(:make_supervised_worker)
42
+ Console.warn(self, "Async::Container::Supervisor is replaced by Async::Services::Supervisor, please update your service definition.")
43
+
44
+ evaluator.make_supervised_worker(instance).run
45
+ end
46
+
47
+ server = evaluator.make_server(@bound_endpoint)
57
48
 
58
- container.run(name: self.name, **container_options) do |instance|
59
- evaluator = @environment.evaluator
49
+ Async do |task|
50
+ server.run
60
51
 
61
- Async do |task|
62
- if @environment.implements?(Async::Container::Supervisor::Supervised)
63
- evaluator.make_supervised_worker(instance).run
64
- end
65
-
66
- server = evaluator.make_server(@bound_endpoint)
67
-
68
- server.run
69
-
70
- instance.ready!
71
-
72
- if health_check_timeout
73
- Async(transient: true) do
74
- while true
75
- # We only update this if the health check is enabled. Maybe we should always update it?
76
- instance.name = "#{self.name} (#{server.statistics_string} L=#{Fiber.scheduler.load.round(3)})"
77
- sleep(health_check_timeout / 2)
78
- instance.ready!
79
- end
80
- end
81
- end
82
-
83
- task.children.each(&:wait)
84
- end
52
+ task.children.each(&:wait)
85
53
  end
54
+
55
+ server
56
+ end
57
+
58
+ # Format the process title with server statistics.
59
+ #
60
+ # @parameter evaluator [Environment::Evaluator] The environment evaluator.
61
+ # @parameter server [Falcon::Server] The server instance.
62
+ # @returns [String] The formatted process title.
63
+ private def format_title(evaluator, server)
64
+ load = Fiber.scheduler.load.round(3)
65
+ "#{evaluator.name} (#{server.statistics_string} L=#{load})"
86
66
  end
87
67
 
88
68
  # Close the bound endpoint.
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2025, by Samuel Williams.
5
5
 
6
6
  module Falcon
7
- VERSION = "0.52.3"
7
+ VERSION = "0.53.0"
8
8
  end
data/license.md CHANGED
@@ -27,6 +27,7 @@ Copyright, 2024, by Stefan Buhrmester.
27
27
  Copyright, 2024, by Ismael Celis.
28
28
  Copyright, 2025, by Pierre Montelle.
29
29
  Copyright, 2025, by Jared Smith.
30
+ Copyright, 2025, by Yoji Shidara.
30
31
 
31
32
  Permission is hereby granted, free of charge, to any person obtaining a copy
32
33
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -47,6 +47,10 @@ Please see the [project documentation](https://socketry.github.io/falcon/) for m
47
47
 
48
48
  Please see the [project releases](https://socketry.github.io/falcon/releases/index) for all releases.
49
49
 
50
+ ### v0.52.4
51
+
52
+ - Relax dependency on `async-container-supervisor` to allow `~> 0.6`.
53
+
50
54
  ### v0.52.0
51
55
 
52
56
  - Modernized codebase and dropped support for Ruby v3.1.
@@ -98,13 +102,13 @@ In addition, `falcon serve` provides two new options:
98
102
  The current configuration format uses definitions like this:
99
103
 
100
104
  ``` ruby
101
- rack 'hello.localhost', :self_signed_tls
105
+ rack "hello.localhost", :self_signed_tls
102
106
  ```
103
107
 
104
108
  This changes to:
105
109
 
106
110
  ``` ruby
107
- service 'hello.localhost' do
111
+ service "hello.localhost" do
108
112
  include Falcon::Environment::Rack
109
113
  include Falcon::Environment::SelfSignedTLS
110
114
  end
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.52.4
4
+
5
+ - Relax dependency on `async-container-supervisor` to allow `~> 0.6`.
6
+
3
7
  ## v0.52.0
4
8
 
5
9
  - Modernized codebase and dropped support for Ruby v3.1.
@@ -106,13 +110,13 @@ In addition, `falcon serve` provides two new options:
106
110
  The current configuration format uses definitions like this:
107
111
 
108
112
  ``` ruby
109
- rack 'hello.localhost', :self_signed_tls
113
+ rack "hello.localhost", :self_signed_tls
110
114
  ```
111
115
 
112
116
  This changes to:
113
117
 
114
118
  ``` ruby
115
- service 'hello.localhost' do
119
+ service "hello.localhost" do
116
120
  include Falcon::Environment::Rack
117
121
  include Falcon::Environment::SelfSignedTLS
118
122
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.3
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -31,6 +31,7 @@ authors:
31
31
  - Stefan Buhrmester
32
32
  - Tad Thorley
33
33
  - Tasos Latsas
34
+ - Yoji Shidara
34
35
  bindir: bin
35
36
  cert_chain:
36
37
  - |
@@ -98,14 +99,14 @@ dependencies:
98
99
  requirements:
99
100
  - - "~>"
100
101
  - !ruby/object:Gem::Version
101
- version: 0.5.0
102
+ version: '0.6'
102
103
  type: :runtime
103
104
  prerelease: false
104
105
  version_requirements: !ruby/object:Gem::Requirement
105
106
  requirements:
106
107
  - - "~>"
107
108
  - !ruby/object:Gem::Version
108
- version: 0.5.0
109
+ version: '0.6'
109
110
  - !ruby/object:Gem::Dependency
110
111
  name: async-http
111
112
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +141,14 @@ dependencies:
140
141
  requirements:
141
142
  - - "~>"
142
143
  - !ruby/object:Gem::Version
143
- version: '0.10'
144
+ version: '0.16'
144
145
  type: :runtime
145
146
  prerelease: false
146
147
  version_requirements: !ruby/object:Gem::Requirement
147
148
  requirements:
148
149
  - - "~>"
149
150
  - !ruby/object:Gem::Version
150
- version: '0.10'
151
+ version: '0.16'
151
152
  - !ruby/object:Gem::Dependency
152
153
  name: bundler
153
154
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file