abide
English | 中文
跨进程并发闸:用锁文件把同时进行的操作数压在容量以内。
安装
pip install abide
用法
from abide import GateLock
gate = GateLock("./locks", m_capacity=4, n_ttl=120, n_timeout=30)
with gate.slot() as index:
call_the_rate_limited_api()
说明
名额是共享目录里的 slot-<i>.lock 文件,O_EXCL 抢占,因此多进程、多机共享同一目录都拦得住。持有者被强杀时,超过 n_ttl 秒的过期名额会被下一个申请者回收。不可重入:嵌套 with 各占一个名额。
许可证
MIT
English
Cross-process concurrency gate with leased lock-file slots.
Install
pip install abide
Usage
from abide import GateLock
gate = GateLock("./locks", m_capacity=4, n_ttl=120, n_timeout=30)
with gate.slot() as index:
call_the_rate_limited_api()
Notes
Slots are slot-<i>.lock files created with O_EXCL in a shared directory, so the limit holds across processes and machines. A slot older than n_ttl is reclaimed from a dead holder. Not re-entrant: nested blocks each take a slot.
License
MIT
Metadata
Release files for abide 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| abide-0.0.3.tar.gz | 3.9 kB | Without provenance | Details for abide-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| abide-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for abide-0.0.3-py3-none-any.whl |
Total release size: 8.1 kB
Release files / abide-0.0.3.tar.gz
| Download URL | abide-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ac69c7e57f17167c2b147bc846a349d15d4de07abae20c6ebc5db7345f2326e
|
|
BLAKE2b-256 checksum How to use checksums |
ae95922fac72c7f792f35dc929fc2096fdf5e56aed011321953f104e7d26fbaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / abide-0.0.3-py3-none-any.whl
| Download URL | abide-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
618ddfeb89bd0d0c7cec0748150cde47d9e9b900f6c258085bfa5c84fd064fe0
|
|
BLAKE2b-256 checksum How to use checksums |
13da06a69959a896d8fdb26c18c480c2513e2a99fd96622804678c88610e9ef9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for abide 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.