http-client icon indicating copy to clipboard operation
http-client copied to clipboard

`httpJSON` etc. are not very responsive to `killThread`

Open mitchellwrosen opened this issue 6 years ago • 4 comments
trafficstars

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.

mitchellwrosen avatar Jun 22 '19 19:06 mitchellwrosen

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?

snoyberg avatar Jun 23 '19 02:06 snoyberg

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?

mitchellwrosen avatar Jun 26 '19 03:06 mitchellwrosen

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 .

snoyberg avatar Jun 26 '19 05:06 snoyberg

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.

mitchellwrosen avatar Jun 26 '19 14:06 mitchellwrosen