Open bvallant opened 9 months ago
Calling then() only has an effect if the SyncFuture is still pending. Should probably behave more like this:
then()
SyncFuture
def then(self, on_complete: Callable) -> "SyncFuture": ret = SyncFuture() def call_and_resolve(v: Any) -> None: try: ret.set_result(on_complete(v)) except Exception as e: ret.set_exception(e) if self._state == _FINISHED: call_and_resolve(self.result()) else: self.add_done_callback(call_and_resolve) return ret
Calling
then()
only has an effect if theSyncFuture
is still pending. Should probably behave more like this: