百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

delay-timer

> 编程语言
开源

延迟任务的时间管理器。类似于 crontab,但支持同步异步任务的调度,并支持动态添加、取消和删除。

329 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

延迟任务的时间管理器。类似于 crontab,但支持同步异步任务的调度,并支持动态添加、取消和删除。

delay-timer

Time-manager of delayed tasks. Like crontab, but synchronous asynchronous tasks are possible, and dynamic add/cancel/remove is supported.

delay-timer is a task manager based on a time wheel algorithm, which makes it easy to manage timed tasks, or to periodically execute arbitrary tasks such as closures.

The underlying runtime is based on the optional smol and tokio, and you can build your application with either one.

The minimum-supported version of rustc is 1.56.

Except for the simple execution in a few seconds, you can also specify a specific date, such as Sunday at 4am to execute a backup task.

Supports configuration of the maximum number of parallelism of tasks.
Dynamically cancel a running task instance by means of a handle.

If you're looking for a distributed task scheduling platform, check out the delicate

Examples

…

Use in asynchronous contexts.

…

Capture the specified environment information and build the closure & task:

rust
#[macro_use]
use delay_timer::prelude::*;

use std::sync::atomic::{
    AtomicUsize,
    Ordering::{Acquire, Release},
};
use std::sync::Arc;

let delay_timer = DelayTimer::new();
let share_num = Arc::new(AtomicUsize::new(0));
let share_num_bunshin = share_num.clone();

let body = move || {
    share_num_bunshin.fetch_add(1, Release);
};

let task = TaskBuilder::default()
    .set_frequency_count_down_by_cron_str(expression, 3)
    .set_task_id(1)
    .spawn_routine(body)?;

delay_timer.add_task(task)?;

Building customized-dynamic future tasks:

…

There's a lot more in the [examples] directory.

License

Licensed under either of

  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

To Do List

  • Support tokio Ecology.
  • Disable unwrap related methods that will panic.
  • Thread and running task quit when delayTimer drop.
  • neaten todo in code, replenish tests and benchmark.
  • batch-opration.
  • report-for-server.
  • Future upgrade of delay_timer to multi-wheel mode, different excutor handling different wheels e.g. subtract laps for one wheel, run task for one wheel.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustcroncrontabdelay-timerdelayed-tasks

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言