Video in progress
What is a fallback? Which fallbacks are good and which are dangerous?
A fallback is the backup response returned when the main call fails: a cached value, an empty list, or "try again later". A good fallback doesn't mislead the user; a dangerous one hides the error and presents wrong data as if it were true.
📖 Answer
Good examples:
- the recommendations service is down: we don't show the recommendations block, and the rest of the page works;
- the exchange rate service doesn't respond: we show the cached rate from 5 minutes ago and write the "last updated" time;
- the delivery price couldn't be calculated: we say "the price will be determined when you confirm the order".
Dangerous examples:
- the stock service didn't respond and the fallback returned
inStock = true: you end up selling a product that isn't in the warehouse; - the payment status is unknown and the fallback says
SUCCESS; - the fallback calls yet another slow service, and that one goes down too.
The rule is simple: a fallback must be safe for the business. Where money, stock or permissions are involved, the right fallback is often to return a clear error. And write a log line or a metric every time a fallback fires, otherwise nobody notices that the system has been running "half broken" for weeks.
Sign up to mark studied questions and save your progress.