一键导入
goyacodedevutils-yabackoff
Simple exponential back-off strategy for retry loops. Use instead of a hand-rolled sleep-and-double retry loop.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Simple exponential back-off strategy for retry loops. Use instead of a hand-rolled sleep-and-double retry loop.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | goyacodedevutils-yabackoff |
| description | Simple exponential back-off strategy for retry loops. Use instead of a hand-rolled sleep-and-double retry loop. |
Import path: github.com/YaCodeDev/GoYaCodeDevUtils/yabackoff.
Exponential back-off strategy for retry loops.
Backoff interface — Next() time.Duration, Current() time.Duration, Wait(), Reset().Exponential struct (implements Backoff); NewExponential(initialInterval, multiplier, maxInterval, resetAfter time.Duration) Exponential.const DefaultInitialInterval = 500ms, DefaultMultiplier = 1.5, DefaultMaxInterval = 60s.Exponential is usable: missing/zero constructor args are lazily replaced with the package defaults on first Next()/Current() call.resetAfter (4th constructor arg): if the time since the last Next() call exceeds it, the interval auto-resets to the initial value; pass 0 to disable auto-reset.yatgclient for reconnect backoff.BackoffModule (fx.go) provides a Backoff from a supplied ExponentialParams.Index of every GoYaCodeDevUtils utility package (config, errors, logging, caching, rate limiting, backoff, hashing, gzip, RSA, feature flags, FSM, thread-safe collections, locales, Telegram bot stack) with a pointer to each package's own skill. Use before hand-rolling infrastructure code GoYaCodeDevUtils may already provide.
High-level Telegram bot framework on top of gotd/td - router/dispatcher with filters and middleware, FSM-aware routing, per-user localization, sequential-update scheduling, and a message-send queue. Use as the starting point for any Telegram bot.
Thin wrapper around gotd/td's telegram.Client adding background-connect-with-retry, bot-token authorization, updates.Manager wiring, and SOCKS5/MTProto proxy helpers. Use for direct low-level Telegram client control instead of raw gotd/td.
Redis-backed persistence for gotd/td's updates.Manager state (pts/qts/seq/date via RedisJSON) plus channel/user access-hash bookkeeping, and a GORM/AES-encrypted session-storage layer. Use for any yatgclient/yatgbot state or session persistence.
Generic pluggable key-value cache abstraction with interchangeable in-memory and Redis backends, hash-oriented API. Use for any caching/session-store need instead of hand-rolling a map or a bare redis.Client call.
Loads JSON locale files into a nested key-tree with lookup, {placeholder} formatting, JSON serving, language-tag normalization, and Go-struct codegen. Use for any i18n/localization instead of hand-rolled JSON locale loading.