Closed Turbo87 closed 4 years ago
@Turbo87 good catch, I think you're right:
The cancelable promise helpers only seem to take into account those too. I think there's a built-in assumption that the cancelable promise helpers would be passed promise-ified task instances (which always have an __ec_cancel__
) or TaskInstances, but that doesn't hold true for the more loosely defined "yieldables" that folks would probably expect to work here.
This is probably what's happening in #308 too.
Changing the implementation to make it similar to timeout
so that it has an __ec_cancel__
is a quick fix for rawTimeout
, but there's probably some other refactoring that needs to happen to work with the WaitFor
-derived yieldables too. I'll take a look at this tonight, but if you get a PR up for the rawTimeout
stuff before then, I'd merge that.
Closed by #331
I've tried the above code, but it seems like the
race()
function is not considering the return value ofrawTimeout()
as something that can be waited upon. Usingtimeout()
works fine though, so now I'm wondering if we should adjust the implementation ofrawTimeout()
to roughly match the one fromtimeout()
🤔/cc @maxfierke @machty