Skip to content

Commit

Permalink
fix: ensure timeout not nil to avoid `attempt to perform arithmetic o…
Browse files Browse the repository at this point in the history
…n a nil value` error (#214)
  • Loading branch information
nic-chen authored Apr 7, 2024
1 parent ba32ec2 commit 5f883c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
git clone https://github.com/openresty/test-nginx.git test-nginx
cd test-nginx && (sudo cpanm --notest . > build.log 2>&1 || (cat build.log && exit 1)) && cd ..
wget https://raw.githubusercontent.com/api7/apisix-build-tools/master/build-apisix-base.sh
wget https://raw.githubusercontent.com/api7/apisix-build-tools/refs/tags/apisix-base/1.21.4.2.2/build-apisix-base.sh
chmod +x build-apisix-base.sh
OR_PREFIX=$OPENRESTY_PREFIX ./build-apisix-base.sh latest
Expand Down
3 changes: 2 additions & 1 deletion lib/resty/etcd/v3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ function refresh_jwt_token(self, timeout)
end

if self.requesting_token then
self.sema:wait(timeout)
local wait_timeout = timeout or self.timeout or 0
self.sema:wait(wait_timeout)
if self.jwt_token and now() - self.last_auth_time < 60 * 3 + random(0, 60) then
return true, nil
end
Expand Down

0 comments on commit 5f883c0

Please sign in to comment.