mirror of
https://github.com/blindlobstar/go-interview-problems
synced 2025-04-28 20:55:15 +00:00
13 lines
521 B
Markdown
13 lines
521 B
Markdown
# Request With Failover
|
|
Attempts to retrieve data from multiple sources with timeout-based failover logic.
|
|
|
|
Behavior:
|
|
- Launches a request to each address with a 500ms timeout.
|
|
- If a request errors, the next address is tried immediately.
|
|
- If a request hangs, the next one is attempted in parallel after 500ms, but the previous request is still allowed to complete.
|
|
- Returns the first successful result from any address.
|
|
- If all attempts fail, returns `ErrRequestsFailed`
|
|
|
|
## Tags
|
|
`Concurrency` `Context` `Failover`
|