First successful result from parallel calls under a global timeout

0
Remix

A backend API is slow and sometimes fails. To answer quickly, call several of these functions in parallel and return the first result that succeeds. Write a function that takes the list of calls and one overall deadline. Return the first success; if every call fails, report the failures; if the deadline passes first, give up with a timeout. Make sure calls that are still running after you return are cancelled or cleaned up, and talk through how errors and the timeout are surfaced.

AppleTechnical phone screenLast asked Sep 2026
No answer yet. Write the first one; the best answer gets endorsed.