Cancellation token in http_client request

May 21, 2013 at 9:58 AM
Hi,

Is it possible to cancel the pplx::task created from an http_client request? I would expect to supply a cancellation token but looks like this isn't exposed?

thanks
Matt
May 21, 2013 at 1:55 PM
Right, we do not support cancellation at this time. It's on the list of things to do.

Niklas
May 21, 2013 at 10:20 PM
Thanks for the response Niklas, I look forwards to it.
Jul 29, 2013 at 6:31 AM
Wow, that's a pretty serious feature that right now I'm really wishing was implemented. I'm already pretty far into this project.

When the server goes missing for whatever reason, I have to wait for the 30 second time out. If my plugin gets unloaded, my no-longer-loaded lambda gets called after the timeout and crashes the application. I don't really have control over when the plugin gets unloaded. The only thing I can do is to keep a list of tasks and hang the UI until they all complete. This is what I'll have to do until I can cancel pending tasks.

What's the ETA on this?
Coordinator
Aug 6, 2013 at 6:11 PM
Hi kgiordano,

I understand how cancellation can be an important feature, particularly in scenarios involving shutdown. At this point I can't commit to giving you an exact time estimate on when we will have this feature added.

I have opened up a new feature request for HTTP client request cancellation support. You should up vote the issue as this appears to be a nearly blocking issue for you.

Thanks,
Steve
Aug 6, 2013 at 7:31 PM
Thanks for the help.

I'm going to reduce the timeout to 5 seconds for now. The only time I will have to hang the UI is if the server doesn't respond AND the application directs the plugin to shutdown.
Aug 12, 2013 at 11:35 PM
Interesting use case. Is there a way to work around this? I am a bit worried since this seems to be common case in the mobile environment which we will be targeting as well. It should be able to happen in desktop as well.

If you add try/catch can this be silently resolved (i.e.: as a workaround)?
Aug 15, 2013 at 10:26 AM
Woah, yeah this is a fairly fundamental feature that is causing me a problem too on my shutdown behaviour. I very much look forward to cancellation being implemented, and I'll reduce the timeout / live with a temporary hang in the meantime...
Coordinator
Mar 22, 2014 at 4:57 AM
FYI everyone in our 2.0 release we implemented this for the Windows platforms (desktop, store, phone). We will add support to other platforms for this feature in future releases.