Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Small and medium teams
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
x-thooh
timingwheel
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
timingwheel
/
task_queue.sql
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
23 lines (23 loc) · 1.61 KB
master
Breadcrumbs
timingwheel
/
task_queue.sql
Copy path
Top
File metadata and controls
Code
Blame
23 lines (23 loc) · 1.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CREATE TABLE task_queue (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
task_no BIGINT UNSIGNED NOT NULL COMMENT '任务唯一编号,雪花算法生成,业务唯一标识',
payload JSON NULL COMMENT '任务数据-{"callback":"xxx", "data":{}}',
delay_time INT NOT NULL DEFAULT 0 COMMENT '延迟秒数,>0表示延迟任务',
timeout INT NOT NULL DEFAULT 60 COMMENT '任务超时时间(秒)',
backoff JSON NULL COMMENT '失败重试间隔数组,单位秒,例如 [5,15,60]',
cron_expr VARCHAR(100) NULL COMMENT 'Cron 表达式,NULL表示一次性任务',
`status` TINYINT NOT NULL DEFAULT 0 COMMENT '0待执行 1执行中 2成功 3失败',
next_run_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '下次执行时间',
run_timeout_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '执行超时时间:下次执行时间+超时时间',
fail_count INT NOT NULL DEFAULT 0 COMMENT '当前失败次数',
fail_msgs JSON NULL COMMENT '失败信息数组',
last_retry_at DATETIME(6) NULL COMMENT '最后一次重试时间',
locked_by TINYINT NOT NULL DEFAULT 0 COMMENT '锁定程序序号',
extra JSON NULL COMMENT '额外信息',
created_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
updated_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
PRIMARY KEY (id),
UNIQUE KEY udx_task_no(task_no),
KEY idx_status_next_run_locked_by (`status`, next_run_at, locked_by),
KEY idx_status_timeout_at (`status`, run_timeout_at, locked_by)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
You can’t perform that action at this time.