Skip to content

Commit

Permalink
[resolver] remove parallel dns query
Browse files Browse the repository at this point in the history
lets delegate this work to a dns resolver like dnsmasq

it was broken and sometimes would return a string "killed" instead of
table with answers that would count as valid answer
  • Loading branch information
mikz committed Mar 17, 2017
1 parent 1aa004d commit c61c0fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed

- Removed support for sending Request logs [PR #296](https://github.com/3scale/apicast/pull/296)
- Support for parallel DNS query [PR #311](https://github.com/3scale/apicast/pull/311)

### Known Issues

Expand Down
34 changes: 1 addition & 33 deletions apicast/src/resty/resolver/dns_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,37 +62,6 @@ local function query(resolver, qname, opts, nameserver)
return resolver:query(qname, opts)
end

local function parallel_query(resolvers, qname, opts)
local threads = {}
local n = #resolvers

if n < 1 then
return nil, 'no resolvers'
end

for i=1, n do
insert(threads, th_spawn(query, resolvers[i].resolver, qname, opts, resolvers[i].nameserver))
end

local answers, err

do
local found, ok
local i=1
repeat
ok, answers, err = th_wait(unpack(threads))
i = i + 1
found = ok and answers and not answers.errcode and not err
until found or i > n
end

for i=1, n do
th_kill(threads[i])
end

return answers, err
end

local function serial_query(resolvers, qname, opts)
local answers, err

Expand All @@ -114,8 +83,7 @@ function _M.query(self, qname, opts)
resolvers = self:init_resolvers()
end

-- this is here so you can try the other one when suspicous something is wrong
return (parallel_query or serial_query)(resolvers, qname, opts)
return serial_query(resolvers, qname, opts)
end

return _M

0 comments on commit c61c0fc

Please sign in to comment.