Skip to content
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

fix: let etcd v3 read_watch handle the case where a chunk contains partial event or multiple events #154

Merged
merged 14 commits into from
Mar 3, 2022
Prev Previous commit
rename variable
  • Loading branch information
nic-6443 committed Mar 2, 2022
commit bb205950578cc3e2e1f4edfa1701020aa71de298
12 changes: 6 additions & 6 deletions lib/resty/etcd/v3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,9 @@ local function request_chunk(self, method, path, opts, timeout)
body = nil

while(1) do
local chunk, error = res.body_reader()
if error then
return nil, error
local chunk, read_err = res.body_reader()
if read_err then
return nil, read_err
end
if not chunk then
break
Expand All @@ -719,9 +719,9 @@ local function request_chunk(self, method, path, opts, timeout)
return nil, nil
end

local chunks, error = split(body, [[\n]], "jo")
if error then
return nil, "failed to split chunks: " .. error
local chunks, split_err = split(body, [[\n]], "jo")
if split_err then
return nil, "failed to split chunks: " .. split_err
end

local all_events = {}
Expand Down