http-client
http-client copied to clipboard
`httpJSON` etc. are not very responsive to `killThread`
I noticed (while on slow train WiFi) that killThreads take a while to deliver to a thread making an http request like httpJSON. I wonder if the scope of the mask could be reduced.
Looks like this behavior is coming from the usage of bracket inside httpSink. I'm OK with some improvements here for sure, would you be interested in taking a crack at this?
I'm not sure I will have time to dig into this in the near future but I would be happy to chat a bit about the basic issue. I believe the challenge is rewriting:
bracket acquire release action
to
do
acquire1
bracket acquire2 release action
(where acquire = acquire1 >> acquire2).
Basically, bracket is doing too much in the acquire action, and it can hopefully be decomposed into smaller bits, where the mask only applies to the very end. Does that sound correct?
Sounds reasonable.
On Wed, Jun 26, 2019 at 6:41 AM Mitchell Rosen [email protected] wrote:
I'm not sure I will have time to dig into this in the near future but I would be happy to chat a bit about the basic issue. I believe the challenge is rewriting:
bracket acquire release action
to
do acquire1 bracket acquire2 release action
(where acquire = acquire1 >> acquire2).
Basically, bracket is doing too much in the acquire action, and it can hopefully be decomposed into smaller bits, where the mask only applies to the very end. Does that sound correct?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/snoyberg/http-client/issues/405?email_source=notifications&email_token=AAAMCB5A23GLXH3Y4TFTVS3P4LQPXA5CNFSM4H2XOEV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYSHG5Q#issuecomment-505705334, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAMCB3YIXLP7KCLKQFNLPTP4LQPXANCNFSM4H2XOEVQ .
I looked into this a bit, I am starting to think a better strategy might be to insert an allowInterrupt or two at safe moments, since this would cover all uses of the bracket resourceOpen resourceClose pattern.