Introduction
Sometimes, you want to stop a task if it takes too long. withTimeout helps you do that easily.
You want to cancel a slow network request after 5 seconds.
You want to stop a long calculation if it exceeds a time limit.
You want to avoid freezing your app by limiting how long a task runs.
You want to retry a task only if it finishes quickly.
You want to make sure a background job does not run forever.