← Questions
First successful result from parallel calls under a global timeout
0
I was asked this
No reports yet. Sign in to say where you were asked it.
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.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
