Skip to main content

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.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iiapis 0.0.3
File Size Uploaded Provenance
iiapis-0.0.3.tar.gz 3.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for iiapis 0.0.3
File Interpreter ABI Platform
iiapis-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / iiapis-0.0.3.tar.gz

Download URL iiapis-0.0.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7ccf4a05975fc3b78d732ee7cb2a4e71386ecf1ddc6c355537a6c58dea0b7df2
BLAKE2b-256 checksum
How to use checksums
b583f278085eedc3192ae96971bb360de862bfcc1bff831bebdfb5c6cfde7963
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.3-py3-none-any.whl

Download URL iiapis-0.0.3-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ad150f71d3c93d6e8ffd746a6dcf8251200021d2a87855de8f7b06418427798
BLAKE2b-256 checksum
How to use checksums
2e88e84b1b39ba50beb3473ca429886656437f09b511a8b74c36c77b360c0bff
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.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page