Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change owner process for async request to stream_to value #646

Open
rutaka-n opened this issue Aug 10, 2020 · 2 comments
Open

change owner process for async request to stream_to value #646

rutaka-n opened this issue Aug 10, 2020 · 2 comments

Comments

@rutaka-n
Copy link

Hello.
I figure out, that hackney starts tracking process which calls hackney:request even if stream_to parameter is passed.
I expected that when stream_to passed hackney would track this process.
Maybe it should be one more parameter to set the owner process or just use stream_to for this.
What do you think?
If you agree, I can provide a pull request with changes for this.

Have nice day.

@benoitc
Copy link
Owner

benoitc commented Aug 11, 2020

I expected that when stream_to passed hackney would track this process.

what would be the main goal of it? Right now the stream "Owner" (which is the Pid set via stream_t is monitored in the stream process: https://github.com/benoitc/hackney/blob/master/src/hackney_stream.erl#L28

Isn't it enough?

@rutaka-n
Copy link
Author

I have a case when a process should send a request to API when it terminates, I wanted to do it in an async manner, so I use async and stream_to options to handle result in another process. But the process which called request terminating, hackney cancel the request before stream_to process gets a response. I am sure that it is a bit strange and rare situation. I think it would be cool to cover it somehow - add the ability to fully change owner process or at least add a notice in the documentation, that in case the owner process is terminated hackney cancels the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants