Observed since 21 Oct, 11:44 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A best-in-class async request coalescing library for Python.
A best-in-class async request coalescing library for Python (3.9+).
aiocoalesce ensures that multiple concurrent async requests for the same key share a single execution (the "SingleFlight" pattern).
This protects your backend from Thundering Herds without the complexity of Redis or caching layers.
Key Difference: Unlike other libraries, aiocoalesce is Cancellation Safe. If the first user disconnects, the shared work continues for other waiting users.
pip install aiocoalesce
import asyncio
from aiocoalesce import Coalescer
# Create a global coalescer
coalescer = Coalescer()
async def get_user_data(user_id: int):
# Simulate DB call
await asyncio.sleep(1)
return {"id": user_id, "name": "Alice"}
# In your API handler:
async def handler(user_id):
# If 10 requests come in at once for user_id=1,
# 'get_user_data' runs ONLY ONCE.
return await coalescer.run(user_id, get_user_data(user_id))
| Feature | aiocoalesce | Existing singleflight | asyncio.Lock |
|---|---|---|---|
| Pattern | True Coalescing | True Coalescing | Sequential Locking |
| Cancellation | ✅ Shielded (Safe) | ❌ Cascading Fails | ✅ Safe |
| Exec Model | Concurrent | Concurrent | Sequential (Slow) |
Perfect for:
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 18 Dec 2025 | 2 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:44 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:64904527e8643a57199ed4771d661280c29f669e1f9a02158ad561bef9162a3e