GitHub user raboof added a comment to the discussion: [Pekko Streams] Best 
practice for streaming from a resource that can take several seconds/minutes to 
start offering an element

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 / `onDownstreamFinish` on the Pekko 
side.

Ideally I think you'd want to override the `onDownstreamFinish(cause: 
Throwable)` instead of the deprecated `onDownstreamFinish()`, but I don't think 
that should matter here.

It's interesting that you note that it does get cancelled as expected with a 
`Source.repeat`. That suggests 'something' is preventing `onDownstreamFinish` 
from getting called in your custom stage. Indeed, as you mention, the fact that 
you're using a blocking call in `onPull` likely causes other message processing 
for this stream to block as well.

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.

GitHub link: 
https://github.com/apache/pekko/discussions/1572#discussioncomment-11473721

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to