BusyBeaver
中文
BusyBeaver 是一个支持按次数、按周期、按时间间隔等策略执行任务的库。让您代码中需要周期执行的任务,如心跳、心跳上报、定时轮询、定时清理等执行更简单、更可靠。 它本质是一个带可配置重试策略的异步任务执行器,专为 Rust 异步运行时(如 Tokio)打造。无论任务是“固定执行 N 次后停止”,还是“每隔 X 毫秒重复一次”,或是“在指定时间窗口内按间隔执行”,BusyBeaver 都能帮你优雅处理,同时内置指数退避、重试上限、任务监听与进度回调等机制,让你的异步代码不再需要自己手动写一堆 tokio::time + loop + retry 逻辑。
特性
- 可配置的重试策略与退避
- 支持按次数、按周期、按时间间隔等任务类型
- 任务监听与进度回调
- 与 Tokio 集成
集成文档
快速开始
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "sync", "time", "macros"] }
use ;
use Duration;
async
许可证
MIT OR Apache-2.0
English
BusyBeaver BusyBeaver is a task-scheduling library that supports execution strategies based on counts, cycles, and custom time intervals. It streamlines periodic tasks in your codebase—such as heartbeats, metric reporting, scheduled polling, and automated cleanup—making them simpler and more reliable.At its core, BusyBeaver is an asynchronous task executor with configurable retry strategies, purpose-built for Rust async runtimes like Tokio. Whether a task needs to stop after exactly $N$ executions, repeat every $X$ milliseconds, or run at specific intervals within a defined time window, BusyBeaver handles the complexity elegantly. Equipped with built-in mechanisms like exponential backoff, retry limits, task listeners, and progress callbacks, it eliminates the need to manually write tedious tokio::time + loop + retry boilerplate in your asynchronous code.
Features
- Configurable retry policies and backoff
- Task types: fixed count, periodic, time interval
- Task listeners and progress callbacks
- Tokio integration
Integration docs
Quick start
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "sync", "time", "macros"] }
use ;
use Duration;
async
License
MIT OR Apache-2.0