Replies: 2 comments 2 replies
-
Sounds like an interesting case! Indeed you're quite correct that when the client disconnects, I'd expect it to send a RST on the response socket, which should convert to a stream cancellation / Ideally I think you'd want to override the It's interesting that you note that it does get cancelled as expected with a Could you share your async attempt as well? Of course it'd be interesting if you can reproduce this problem in more isolation, for example in a (unit) test where you cancel the stream 'directly' instead of relying on Pekko HTTP and Play. |
Beta Was this translation helpful? Give feedback.
-
At first, I would suggest you delegate the blocking call to a VirtualThread with Java 21, and how about make use of the Source.unfoldAsync ? For the networking , where you may not been notified, so I would suggest you attach a keepalive to get notified if you don't get the RST. |
Beta Was this translation helpful? Give feedback.
-
Hello folks,
I've a situation where I can't find what's the idiomatic way to handle it.
Here's my use case:
ResultSet
... (blocking API) to HTTP responseTransfer-Encoding: chunked
(Play Framework for the record, Pekko HTTP under the hood)ResultSet
onDownstreamFinish
being called until 1 minute(*)(*): with another simpler
Source
like aSource.repeat
, I can see the stream being stopped shortly after interruption on the client side.The current stream implementation relies on a custom graph that can be resumed as:
I was thinking this is because of the blocking call in
onPull
, so I tried to come up with something async but it didn't change anything. I also tried to useunfoldResource
that is very close to what I'm doing in the custom graph but with no improvement either.My knowledge of Pekko Streams is limited, hence I was wondering if anyone ever had a similar use case and was able to come up with something.
(I can provide a more concrete code sample if needed but didn't want to go too much in the details yet).
Beta Was this translation helpful? Give feedback.
All reactions