falcon 0.55.2 → 0.55.3

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: 3e901867477864a82832904cbaa1662105e6dce12190e057d457a666fa3dfe42
4
- data.tar.gz: 523e181a6685bfe398bc5630076ab8e76642bf47181d4e20c62192813f121712
3
+ metadata.gz: 15fd796344aad14ba00e77762e66e298565fca37152a58d0958e2de017eb3df2
4
+ data.tar.gz: 3c93f36c92e58b888b3e22e04a934a53232c2c6e200d0dca0a9d0ea1b824ac04
5
5
  SHA512:
6
- metadata.gz: 0eb64a874478507caeafefb4c83b108cfa7b00326cf69ce7581ab534e9466048dea1572b66044f06ee19b21998fafad32cf5de3ea050f6ae0f32b1743424ef2e
7
- data.tar.gz: 3f041a4ebdf07b1063373a27e7151b4f8380f4f440b34a773f27b0b6761d64f721209c5a7d2366f1210e1be1d3042d1e8bed117a77a7ce81d9335274636fe656
6
+ metadata.gz: 2b21c996cf29059c8f187b5b32d6502c55198e4f8311c270469db21ddbf3e56b47f84a27dbb504f53405be224a7eec6d1d3f38514c0c6601613f5994f0cda7e7
7
+ data.tar.gz: cf27a313ae901795696b4a30d92b7e53b22e1497c6fa79b8044f1c363eabb47dc0b55d0ac39b5947d7056b1be7157e94affc26d182efe12bf1d1eaace9f95270
checksums.yaml.gz.sig CHANGED
Binary file
@@ -14,7 +14,9 @@ module Falcon
14
14
  # then decrements the metric. Use this so requests_active stays elevated until
15
15
  # the request is fully finished (including response_finished callbacks).
16
16
  class RequestFinished < Protocol::HTTP::Body::Wrapper
17
- # Wrap a response body with a metric. If the body is nil or empty, decrements immediately.
17
+ # Wrap a response body with a metric.
18
+ #
19
+ # Expects the caller to have incremented `requests_active` beforehand. If the body is not wrapped (nil or empty message/body, or an error while assigning the wrapper), the `ensure` block decrements once. When wrapped, the metric is decremented in {#close}.
18
20
  #
19
21
  # @parameter message [Protocol::HTTP::Response] The response whose body to wrap.
20
22
  # @parameter metric [Async::Utilization::Metric] The metric to decrement when the body is closed.
@@ -29,6 +31,8 @@ module Falcon
29
31
  message
30
32
  end
31
33
 
34
+ # Initialize the wrapper.
35
+ #
32
36
  # @parameter body [Protocol::HTTP::Body::Readable] The body to wrap.
33
37
  # @parameter metric [Async::Utilization::Metric] The metric to decrement on close.
34
38
  def initialize(body, metric)
data/lib/falcon/server.rb CHANGED
@@ -69,10 +69,22 @@ module Falcon
69
69
  # Body::RequestFinished wrapper runs the decrement after the body closes,
70
70
  # so response_finished callbacks are counted as active.
71
71
  def call(...)
72
+ decrement = false
73
+
72
74
  @requests_total_metric.increment
73
75
  @requests_active_metric.increment
76
+ decrement = true
77
+
78
+ # Roll back `requests_active` unless the full `super` + wrap path completes. Covers
79
+ # `super` raising before `wrap` runs, errors inside `wrap`, and other abnormal exits.
80
+ response = Body::RequestFinished.wrap(super, @requests_active_metric)
81
+ decrement = false
74
82
 
75
- return Body::RequestFinished.wrap(super, @requests_active_metric)
83
+ return response
84
+ ensure
85
+ if decrement
86
+ @requests_active_metric.decrement
87
+ end
76
88
  end
77
89
 
78
90
  # Generates a human-readable string representing the current statistics.
@@ -5,5 +5,5 @@
5
5
 
6
6
  # @namespace
7
7
  module Falcon
8
- VERSION = "0.55.2"
8
+ VERSION = "0.55.3"
9
9
  end
data/readme.md CHANGED
@@ -47,9 +47,13 @@ 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.55.3
51
+
52
+ - Decrement `requests_active` in `Falcon::Server#call` when `super` or `Falcon::Body::RequestFinished.wrap` raises, so utilization metrics are not leaked on error paths.
53
+
50
54
  ### v0.55.2
51
55
 
52
- - Remove unnecessary require for `async/service/supervisor/supervised`."
56
+ - Remove unnecessary require for `async/service/supervisor/supervised`.
53
57
 
54
58
  ### v0.55.1
55
59
 
@@ -91,11 +95,6 @@ Please see the [project releases](https://socketry.github.io/falcon/releases/ind
91
95
 
92
96
  - Add <code class="language-ruby">Falcon::Environment::Server\#endpoint\_options</code> to allow configuration of the endpoint options more easily.
93
97
 
94
- ### v0.49.0
95
-
96
- - [Falcon Server Container Health Checks](https://socketry.github.io/falcon/releases/index#falcon-server-container-health-checks)
97
- - [Falcon Server Process Title](https://socketry.github.io/falcon/releases/index#falcon-server-process-title)
98
-
99
98
  ## Contributing
100
99
 
101
100
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Releases
2
2
 
3
+ ## v0.55.3
4
+
5
+ - Decrement `requests_active` in `Falcon::Server#call` when `super` or `Falcon::Body::RequestFinished.wrap` raises, so utilization metrics are not leaked on error paths.
6
+
3
7
  ## v0.55.2
4
8
 
5
- - Remove unnecessary require for `async/service/supervisor/supervised`."
9
+ - Remove unnecessary require for `async/service/supervisor/supervised`.
6
10
 
7
11
  ## v0.55.1
8
12
 
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.55.2
4
+ version: 0.55.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
312
  - !ruby/object:Gem::Version
313
313
  version: '0'
314
314
  requirements: []
315
- rubygems_version: 4.0.3
315
+ rubygems_version: 4.0.6
316
316
  specification_version: 4
317
317
  summary: A fast, asynchronous, rack-compatible web server.
318
318
  test_files: []
metadata.gz.sig CHANGED
Binary file