Hi Jens,
A couple options:
- You say you can't put the promise in a TaskSet because you need to be able to specifically cancel it. Could you instead use a kj::Canceler to control cancellation? The canceler only wraps the promise, then you could still put it in a TaskSet.
- As a really awful hack, if you know that you are deleting the promise that is currently running, you could use `promise.detach()` instead. `detach()` is usually very bad form because it makes the promise uncancelable, which usually leads to some violations of lifetime guarantees. However, if you know you're at the end of the promise chain anyway -- i.e. as soon as you return from the current function, then the promise is resolved -- then it may be easy to prove that there's no lifetime issues.
-Kenton