I want to address a question that was brought to me in offline discussions around this proposal. A previous version contained the implementation of the proposed withDeadline method, which showed that it is based around two child tasks that are racing with each other. While this is the current implementation and the simplest way to get the semantics to work, this might not be the long-term implementation. In particular, spawning two child tasks can be quite expensive, and underlying executors might be able to handle this better directly. Similar to the APIs proposed in SE-0505: Delayed Enqueuing for Executors, we can expand the APIs of jobs and executors to avoid spawning any child tasks. Importantly, this can be done in a future evolution.
2 Likes