-
Notifications
You must be signed in to change notification settings - Fork 314
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
Fix resource leak for HttpClient-based backends on cancellation #2413
Conversation
|
||
override protected def ensureOnAbnormal[T](effect: Task[T])(finalizer: => Task[Unit]): Task[T] = effect.onExit { | ||
exit => | ||
if (exit.isSuccess) ZIO.unit else finalizer.orDie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's correct to use .orDie
here. I don't think users will expect that sending a request might result in a defect. Defects are often considered unrecoverable and propagate until some higher-level handler catches them, and in some cases can cause the entire application to crash. Maybe in this case it would be better to just ignore the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a .resurrect
later on, but yeah, maybe ignoring here is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, I somehow didn't notice the .resurrect
call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it to a log :)
Closes #1987