Categorygithub.com/yuninks/timerx
modulepackage
1.0.12
Repository: https://github.com/yuninks/timerx.git
Documentation: pkg.go.dev

# README

功能支持

  1. 支持本地任务
  2. 支持集群任务
  3. 支持单次任务

功能说明

功能实现

  1. 集群间任务调度和任务的唯一依赖于redis进行实现

缺陷

  1. 集群部署时,存在新旧的代码混合问题,任务调度可能存在问题(需要根据实际需要进行版本上线/下线操作)

方案一

  1. 启动的时候定时向redis注册任务项
  2. 每次计算执行时间的时候根据注册的任务项进行任务计算
  3. 注册任务项需要有下线机制,避免能运行它的节点下线了它还被执行

现在有根据要求根据系统时间整点运行任务的要求,这个比简单的定时重复更复杂,因为不但要按时执行,并且不能重复执行,需要全局记录任务执行的状态,由于任务的间隔时间不确定,这个任务执行状态的保存周期也是有变化的

# Packages

No description provided by the author

# Functions

计算该任务下次执行时间 @param job *JobData 任务数据 @return time.Time 下次执行时间.
初始化定时器 全局只需要初始化一次.
初始化.
定时器类 @param ctx context.Context 上下文 @param opts ...Option 配置项.
No description provided by the author
设置日志.
设置任务最长执行时间.
设定时区.

# Constants

# Structs

No description provided by the author
No description provided by the author
单次的任务队列.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

需要考虑执行失败重新放入队列的情况.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author