connectrpc-async 0.2.0 → 0.2.1
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 +4 -4
- data/README.md +5 -1
- data/lib/connectrpc/async/application.rb +4 -1
- data/lib/connectrpc/async/connection.rb +23 -12
- data/lib/connectrpc/async/server_session.rb +6 -5
- data/lib/connectrpc/async/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e026f032a90c6a2ace0a2fcc0d337d1a96351937367e768623c1d610168803a
|
|
4
|
+
data.tar.gz: eb5f3ae4c8b3249b16b34b35d53db5b4400e03c83f8336f9ceb0a1641997ee57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b81a90850b9140284f3a3002c34c02a717e5559cfb40b705793f81e3e51c3e1ae58c3dfc81f487929a8b45ad40fd7e26a1da22cd514b11b1ade45c01a220c900
|
|
7
|
+
data.tar.gz: 1907bbf09495f5cc9a226460e1cff93a33a3983c0a5e81bca73dfb888a42ed0f23f6e0175d61e4b79ddcbdd12b72e5240edf7bc56b91280825f5109d2a4bda3d
|
data/README.md
CHANGED
|
@@ -998,7 +998,9 @@ registration lifetime rules.
|
|
|
998
998
|
|
|
999
999
|
The Async transport accepts foreign-thread cancellation through a Promise;
|
|
1000
1000
|
only the owner reactor stops private SDK tasks and performs stream cleanup.
|
|
1001
|
-
|
|
1001
|
+
Cancellation, an expired deadline or a stopped caller task resets the call's
|
|
1002
|
+
stream with `RST_STREAM(CANCEL)`, including while its upload waits for
|
|
1003
|
+
flow-control credit. Healthy multiplexed siblings survive. A stuck frame retains the one 100 ms
|
|
1002
1004
|
raw-first whole-connection cleanup fallback. Native HTTP/2 Context observes
|
|
1003
1005
|
only an actual peer RST_STREAM(CANCEL), before input teardown. Other resets,
|
|
1004
1006
|
normal half-close, connection loss and host shutdown do not fabricate explicit
|
|
@@ -1098,6 +1100,8 @@ their newest releases. `async:verify` checks the independent bundle, installed
|
|
|
1098
1100
|
packages and connect-go interoperability. Core require and core/Rails
|
|
1099
1101
|
dependencies stay independent. The [backend evidence](#verification-evidence)
|
|
1100
1102
|
above describes what these checks exercise.
|
|
1103
|
+
`async:soak` runs the non-gating long-running lifecycle campaign; see
|
|
1104
|
+
[development](../../docs/development.md#lifecycle-campaign).
|
|
1101
1105
|
|
|
1102
1106
|
## License
|
|
1103
1107
|
|
|
@@ -137,12 +137,15 @@ module ConnectRPC
|
|
|
137
137
|
return ::Protocol::HTTP::Response[response.status, Internal.fields(response.headers),
|
|
138
138
|
response.body.empty? ? nil : [response.body]]
|
|
139
139
|
end
|
|
140
|
+
rescue Exception => e # rubocop:disable Lint/RescueException -- failed processing must not drain input
|
|
141
|
+
failure = e
|
|
142
|
+
raise
|
|
140
143
|
ensure
|
|
141
144
|
stream&.detach_cancellation
|
|
142
145
|
# HTTP/1 Finishable retains a reading request until explicit close,
|
|
143
146
|
# even after EOF. The original processor owns this cleanup too.
|
|
144
147
|
if web && !stream
|
|
145
|
-
h1_input ? h1_input.close : request.body&.close
|
|
148
|
+
h1_input ? h1_input.close(failure) : request.body&.close
|
|
146
149
|
end
|
|
147
150
|
end
|
|
148
151
|
body.close_write
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "English"
|
|
4
|
-
|
|
5
3
|
module ConnectRPC
|
|
6
4
|
module Async
|
|
7
5
|
module Internal
|
|
@@ -431,10 +429,17 @@ module ConnectRPC
|
|
|
431
429
|
attr_reader :output_task
|
|
432
430
|
|
|
433
431
|
# Output unwinding on a retiring connection must not attempt another
|
|
434
|
-
# write or reset on its closed socket.
|
|
432
|
+
# write or reset on its closed socket. A cancelled upload means the
|
|
433
|
+
# call no longer needs the stream, which RFC 9113 section 8.7 signals
|
|
434
|
+
# with CANCEL; upstream resets every output error with INTERNAL_ERROR.
|
|
435
435
|
def finish_output(error = nil)
|
|
436
436
|
return if connection.retiring?
|
|
437
437
|
|
|
438
|
+
if error.is_a?(::Async::Cancel) && !closed?
|
|
439
|
+
@output = nil
|
|
440
|
+
send_reset_stream(::Protocol::HTTP2::Error::CANCEL)
|
|
441
|
+
return
|
|
442
|
+
end
|
|
438
443
|
super
|
|
439
444
|
end
|
|
440
445
|
|
|
@@ -576,18 +581,13 @@ module ConnectRPC
|
|
|
576
581
|
incoming.stream.response_task&.wait
|
|
577
582
|
written = incoming.stream.response_written?
|
|
578
583
|
end
|
|
579
|
-
rescue
|
|
584
|
+
rescue Exception => e # rubocop:disable Lint/RescueException -- cancellation also ends the exchange
|
|
580
585
|
error = e
|
|
586
|
+
raise unless e.is_a?(StandardError)
|
|
587
|
+
|
|
581
588
|
reset(incoming.stream, e)
|
|
582
589
|
ensure
|
|
583
|
-
|
|
584
|
-
begin
|
|
585
|
-
cleaned = close_request(response, incoming) { |failure| error ||= failure }
|
|
586
|
-
ensure
|
|
587
|
-
incoming.stream.exchange&.finish(written && cleaned && incoming.stream.response_written? &&
|
|
588
|
-
!@resource.finished?, error || $ERROR_INFO)
|
|
589
|
-
@resource.changed
|
|
590
|
-
end
|
|
590
|
+
finish_request(response, incoming, written, error)
|
|
591
591
|
end
|
|
592
592
|
end
|
|
593
593
|
@resource.track(worker)
|
|
@@ -597,6 +597,17 @@ module ConnectRPC
|
|
|
597
597
|
|
|
598
598
|
private
|
|
599
599
|
|
|
600
|
+
def finish_request(response, incoming, written, error)
|
|
601
|
+
cleaned = close_request(response, incoming) { |failure| error ||= failure }
|
|
602
|
+
rescue Exception => e # rubocop:disable Lint/RescueException -- cleanup escapes also end the exchange
|
|
603
|
+
error ||= e
|
|
604
|
+
raise
|
|
605
|
+
ensure
|
|
606
|
+
incoming.stream.exchange&.finish(written && cleaned && incoming.stream.response_written? &&
|
|
607
|
+
!@resource.finished?, error)
|
|
608
|
+
@resource.changed
|
|
609
|
+
end
|
|
610
|
+
|
|
600
611
|
def close_requests = requests&.close
|
|
601
612
|
|
|
602
613
|
def close_request(response, request)
|
|
@@ -336,14 +336,15 @@ module ConnectRPC
|
|
|
336
336
|
result = lifecycle ? lifecycle.activate(&work) : work.call
|
|
337
337
|
publication.publish(result) if publication && !publication.published?
|
|
338
338
|
result
|
|
339
|
-
rescue
|
|
340
|
-
|
|
339
|
+
rescue Exception => e # rubocop:disable Lint/RescueException -- cancellation also completes publication
|
|
340
|
+
failure = e
|
|
341
|
+
raise unless publication && e.is_a?(StandardError)
|
|
341
342
|
|
|
342
343
|
lifecycle&.record_failure(e)
|
|
343
344
|
publication.complete(e)
|
|
344
345
|
nil
|
|
345
346
|
ensure
|
|
346
|
-
complete_processor(publication, task, key, resource)
|
|
347
|
+
complete_processor(publication, task, key, resource, failure)
|
|
347
348
|
end
|
|
348
349
|
resource.track(handler)
|
|
349
350
|
handler.run
|
|
@@ -382,11 +383,11 @@ module ConnectRPC
|
|
|
382
383
|
end
|
|
383
384
|
end
|
|
384
385
|
|
|
385
|
-
def complete_processor(publication, task, key, resource)
|
|
386
|
+
def complete_processor(publication, task, key, resource, error)
|
|
386
387
|
@identities.delete(task)
|
|
387
388
|
complete_admission(key, processor: true)
|
|
388
389
|
resource.changed
|
|
389
|
-
publication&.complete(
|
|
390
|
+
publication&.complete(error)
|
|
390
391
|
end
|
|
391
392
|
|
|
392
393
|
def complete_admission(key, processor: false, wire: false)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: connectrpc-async
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jimeh
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-11-
|
|
10
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: connectrpc
|