Skip to content

Commit

Permalink
chore(*): release 0.2.1 (#55)
Browse files Browse the repository at this point in the history
### Summary

- fix(tests): fix tests to not be order dependent on multi-worker scenario (#46)
- chore(callback): remove unnecessary assert when the type is already checked (#50)
- chore(queue): rename DEFAULT_QUEUE_LEN to more meaningful MAX_QUEUE_PREALLOCATE (#52)
- chore(callback): split get_callback_list to two functions to avoid unnecessary table creation (#51)
- fix(worker): do not premature kill threads when not exiting (#47)
- fix(broker): do not premature kill threads when not exiting (#48)
- fix(worker): separate communication and event processing to different timers (#53) - caused by #47
  • Loading branch information
bungle authored May 28, 2024
1 parent 7906f0c commit 21d152d
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 34 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# TODO: arm64
- openresty: "1.19.9.1"
- openresty: "1.21.4.1"
- openresty: "1.21.4.2"
- openresty: "1.21.4.3"
- openresty: "1.25.3.1"

env:
Expand Down Expand Up @@ -62,4 +62,3 @@ jobs:
export PATH=${BASE_PATH}/openresty/bin:$PATH
openresty -V
make test OPENRESTY_PREFIX=${BASE_PATH}/openresty
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2022-2024 Kong Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ License
=======

```
Copyright 2022 Kong Inc.
Copyright 2022-2024 Kong Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -266,4 +266,3 @@ See Also
* Kong: https://konghq.com/

[Back to TOC](#table-of-contents)

5 changes: 1 addition & 4 deletions lualib/resty/events/broker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ local function write_thread(self, worker_connection)
return true
end

local _M = {
_VERSION = '0.1.3',
}

local _M = {}
local _MT = { __index = _M, }

function _M.new(opts)
Expand Down
4 changes: 1 addition & 3 deletions lualib/resty/events/callback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ local DEBUG = ngx.DEBUG

local encode = cjson.encode

local _M = {
_VERSION = '0.1.0',
}
local _M = {}
local _MT = { __index = _M, }

function _M.new()
Expand Down
4 changes: 1 addition & 3 deletions lualib/resty/events/codec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ local buf_enc = buffer.new(options)
local buf_dec = buffer.new(options)


local _M = {
_VERSION = "0.1.0",
}
local _M = {}


function _M.encode(obj)
Expand Down
10 changes: 2 additions & 8 deletions lualib/resty/events/compat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local handlers = {}
local _configured

local _M = {
_VERSION = '0.1.0',
_VERSION = "0.1.0",
}

function _M.poll()
Expand All @@ -29,7 +29,6 @@ function _M.configure(opts)
ev = require("resty.events").new(opts)

local ok, err = ev:init_worker()

if not ok then
return nil, err
end
Expand All @@ -49,7 +48,6 @@ end

_M.post = function(source, event, data, unique)
local ok, err = ev:publish(unique or "all", source, event, data)

if not ok then
return nil, err
end
Expand All @@ -59,7 +57,6 @@ end

_M.post_local = function(source, event, data)
local ok, err = ev:publish("current", source, event, data)

if not ok then
return nil, err
end
Expand All @@ -69,19 +66,16 @@ end

_M.register = function(callback, source, event, ...)
local events = {event or "*", ...}

for _, e in ipairs(events) do
local id = ev:subscribe(source or "*", e or "*", callback)

handlers[callback] = id
end
end

_M.register_weak = _M.register

_M.unregister = function(callback, source, ...)
_M.unregister = function(callback)
local id = handlers[callback]

if not id then
return
end
Expand Down
4 changes: 1 addition & 3 deletions lualib/resty/events/frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ local assert = assert
local tostring = tostring


local _M = {
_VERSION = "0.2.0",
}
local _M = {}


-- frame format: Len(3 bytes) + Payload(max to 2^24 - 1 bytes)
Expand Down
2 changes: 1 addition & 1 deletion lualib/resty/events/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local str_sub = string.sub
local worker_count = ngx.worker.count()

local _M = {
_VERSION = '0.2.0',
_VERSION = "0.2.1",
}
local _MT = { __index = _M, }

Expand Down
2 changes: 0 additions & 2 deletions lualib/resty/events/protocol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ local function send_frame(self, payload)
end

local _Server = {
_VERSION = "0.1.0",
is_closed = is_closed,
is_timeout = is_timeout,
recv_frame = recv_frame,
Expand Down Expand Up @@ -91,7 +90,6 @@ end


local _Client = {
_VERSION = "0.1.0",
is_closed = is_closed,
is_timeout = is_timeout,
recv_frame = recv_frame,
Expand Down
4 changes: 1 addition & 3 deletions lualib/resty/events/worker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ local PAYLOAD_T = {
--local _worker_pid = ngx.worker.pid()
local _worker_id = ngx.worker.id() or -1

local _M = {
_VERSION = '0.2.0',
}
local _M = {}
local _MT = { __index = _M, }

-- gen a random number [0.01, 0.05]
Expand Down
3 changes: 1 addition & 2 deletions src/ngx_lua_events_module.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019-2022 Kong Inc.
* Copyright 2019-2024 Kong Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -89,4 +89,3 @@ ngx_lua_ffi_disable_listening_unix_socket(ngx_str_t *sock_name)

#endif
}

0 comments on commit 21d152d

Please sign in to comment.