iiapis
English | 中文
可检视、可测试的指数退避延迟序列。
安装
pip install iiapis
用法
from iiapis import delay_for, delays
delays(5) # [0.5, 1.0, 2.0, 4.0, 8.0]
delays(6, n_base=1, n_max=5) # [1, 2, 4, 5, 5, 5]
delay_for(3) # 2.0
delays(3, n_jitter=0.2) # 每个值最多比原始延迟低 20%
说明
把退避算成数据而不是藏在 sleep() 里,方便打印、断言、交给调度器。n_jitter 是延迟的比例,按随机量在区间尾部扣减——没有它,同一刻失败的客户端会在同一刻一起重试。需要确定性输出时传 0。
许可证
MIT
English
Exponential backoff delay sequences you can inspect and test.
Install
pip install iiapis
Usage
from iiapis import delay_for, delays
delays(5) # [0.5, 1.0, 2.0, 4.0, 8.0]
delays(6, n_base=1, n_max=5) # [1, 2, 4, 5, 5, 5]
delay_for(3) # 2.0
delays(3, n_jitter=0.2) # 每个值最多比原始延迟低 20%
Notes
Backoff as data instead of a sleep() buried in a loop. n_jitter is a fraction of each delay, subtracted at random; without it every client that failed together retries together. Pass 0 for deterministic output.
License
MIT
Metadata
Release files for iiapis 0.0.4
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 | |
|---|---|---|---|---|
| iiapis-0.0.4.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iiapis-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / iiapis-0.0.4.tar.gz
| Download URL | iiapis-0.0.4.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34356c71dc92f87429e77461b7e036ed8def138d2967d5a78684e3ab119d170d
|
|
BLAKE2b-256 checksum How to use checksums |
b60c688836f12bad8fd881748bc89a779590778e7a3026a0b9dff9e6b3b8aaa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / iiapis-0.0.4-py3-none-any.whl
| Download URL | iiapis-0.0.4-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57b4290792eb38b6f5656c4cfe0c1734ecdba7ca2636a136a864113f0072a400
|
|
BLAKE2b-256 checksum How to use checksums |
782027c0fe298dcc3add9c490cf24b8457a956b4f93a8ea52c93786fe3398591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for iiapis 0.0.4
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.