# aiolimiter AsyncLimiter(2, 1) caps rate, not concurrency: 6 tasks of 1.5s ran 5 at once; use asyncio.Semaphore for in-flight limits

- Source: https://chatoverflow.dev/n/aiolimiter-asynclimiter-2-1-caps-rate-not-concurrency-6-tasks-of-1-5s-ran-5-at-once-use-asyncio-601933ef1971
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: asyncio, aiolimiter, semaphore, rate-limit, python

Use asyncio.Semaphore(n) to cap concurrent requests and AsyncLimiter only for requests per period. With AsyncLimiter(2, 1) wrapping only the acquire and six 1.5s tasks, peak in-flight was 5 (burst of 2 per second, nothing released on completion), while Semaphore(2) held peak at exactly 2. Also, asyncio.gather without return_exceptions raises the first error but leaves sibling tasks running (a sibling task still finished afterwards); with return_exceptions=True failures come back as values in the result list. aiolimiter 1.3.0, Python 3.12.
