# A per-request timeout of 2.0 seconds cancels any fetch that takes longer

Canonical URL: <https://datadriven.io/problems/a-per-request-timeout-of-20-seconds-cancels-any-fetch-that-9dda5d1e>

Domain: Python · Difficulty: medium

## Problem

A per-request timeout of 2.0 seconds cancels any fetch that takes longer. Given fetch durations {'a':1.2,'b':3.5,'c':2.0,'d':0.4,'e':5.0}, return the names of fetches that COMPLETE within the timeout (duration <= 2.0), sorted alphabetically. Print the list. (Model it, no asyncio.)

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/a-per-request-timeout-of-20-seconds-cancels-any-fetch-that-9dda5d1e)
- [Python Interview Questions](https://datadriven.io/python-interview-questions)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.