1 Star 2 Fork 0

baiyangzhuhong / openresty-lua-timer

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

openresty-lua-timer

介绍

基于openresty ngx_lua开发的一款应用于定时作业的定时器框架,支持创建和取消定时器。 框架基础代码从开源项目lua-resty-timer(https://github.com/Kong/lua-resty-timer)而来,但对框架存在的内存泄漏问题进行了修复,并添加了一些方便管理的接口,及一些代码机制的调整。

安装教程

下载源码, 使用luarocks编译安装

使用说明

-- create timer
local resty_timer = require("resty.timer")
local interval = 5 -- seconds
local health_mode = "healthy"
local CHECK_JITTER = 0.1

local function callback ()

end

local timer_uuid, err = resty_timer({
    interval = interval,
    recurring = true,
    immediate = true,
    detached = true,
    expire = callback,
    cancel = nil,
    shm_name = self.shm_name,
    key_name = self.PERIODIC_LOCK .. health_mode,
    sub_interval = math.min(interval, 0.5),
    jitter = CHECK_JITTER,
}, self.name, health_mode)
if not timer_uuid then
    -- log
end

参与贡献

  1. Fork 本仓库
  2. 提交代码
  3. 新建 Pull Request

Repository Comments ( 0 )

Sign in for post a comment

About

基于openresty ngx_lua开发的一款应用于定时作业的定时器框架,支持创建和取消定时器。 框架基础代码从开源项目lua-resty-timer(https://github.com/Kong/lua-resty-timer)而来,但对框架存在的内存泄漏问题进行了修复,并添加了一些方便管理的接口,及一些代码机制的调整。 expand collapse
Lua
Apache-2.0
Cancel

Releases (2)

All

Contributors

All

Activities

Load More
can not load any more
Lua
1
https://gitee.com/baiyangzhuhong/openresty-lua-timer.git
git@gitee.com:baiyangzhuhong/openresty-lua-timer.git
baiyangzhuhong
openresty-lua-timer
openresty-lua-timer
master

Search

141041 ab9339c7 1850385 141043 25c028d5 1850385