Limits
limits
Process-wide politeness: concurrent requests are capped per remote host.
Every thread and every source of a process share one limit per host, so a campaign that opens several sources (or several enrichers) does not multiply the load on a server. Defaults follow each provider's capacity: object stores built for parallel reads (Google Cloud Storage, AWS S3) get a generous cap; Météo-France's distribution, which asks its API users not to download in parallel, gets a small one.
Asynchronous readers (Open-Meteo) run on one shared event loop per process so that the same caps apply to them.
async_slot(url)
The host's semaphore on the shared event loop (call from that loop only).
Source code in packages/barograph-met/src/baro/met/limits.py
host_limit(url_or_host)
Concurrent requests allowed to the host of url_or_host.
Source code in packages/barograph-met/src/baro/met/limits.py
run_async(coro)
Run coro on the process-wide I/O event loop and wait for its result.
Libraries whose async readers must always be driven from the same loop (omfiles) are safe, and per-host async caps are shared process-wide.
Source code in packages/barograph-met/src/baro/met/limits.py
set_host_limit(host, limit)
Change the cap for host (takes effect for hosts not contacted yet).
Source code in packages/barograph-met/src/baro/met/limits.py
slot(url)
Hold one of the host's request slots (blocking, thread-safe).