-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Req/Res] add tostring on request.lua and response.lua for simplying … #42
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,15 @@ local function str_int64(int) | |
tonumber(band(int, 0xff))) | ||
end | ||
|
||
-- for easy to debug | ||
function mt.__tostring( self ) | ||
local str = "" | ||
for _,v in ipairs(self._req) do | ||
str = str .. tostring(v) .. " " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First of all, I'm not very happy to add these code for debug, I think we'd better have these code on higher level. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should push the segments to table first and then use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What you mean on higher level? I write these codes not only for debug kafka but also this kafka client. I want to make sure if this client sends request correctly and receive response correctly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean you can do this in your own code, over this lib. |
||
end | ||
str = str .. tostring(self.offset) .. " " .. tostring(self.len) | ||
return str | ||
end | ||
|
||
function _M.new(self, apikey, correlation_id, client_id) | ||
local c_len = #client_id | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there can only have two running timers at most.
One is flushing data, another one is acquiring the flush lock ant it will fail soon.
So the running timer is limited:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we should not limit the pending timers, because the pending timers can be failed to turn running :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it will be better when we have
ngx.timer.every
openresty/lua-nginx-module#856There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can limit the pending timer when we got
ngx.timer.every
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fail to turn pending timer running causes an error log which is annoying, :). Here actually limit the total timers including both pending and running timers.
If ngx.timer.every is better, let's look forward to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here actually limit the total timers including both pending and running timers.
Fail to turn pending timer running causes an error log which is annoying