Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cancellable GetCallback and friends #916

@ChrisDirkis

Description

@ChrisDirkis

Is your feature request related to a problem?

I'm trying to implement request cancellation for some requests done via GetCallback. Historically, we'd have a shared_ptr to a flag that's then checked in the callback, but I noticed that 1.10 had some cancellation semantics, so I was interested in using those instead. However, it appears that GetCallback and friends don't support cancellation, only MultiGetAsync and friends do.

Possible Solution

I'd like to see GetCallback be cancellable as MultiGetAsync is. It seems like cpr::async could return AsyncWrapper<T, true>, but the trivial change didn't compile and I haven't looked further into it.

Alternatively, I'd be happy to use MultiGetCallback with 1 request, if such existed.

Alternatives

For now, we can solve this on our end with some shared flag checked in the callback.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions