Skip to content

Commit

Permalink
fix(copas) switch to pause instead of sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Oct 26, 2022
1 parent 1e212c7 commit ed710fc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/copas-example.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local ping = mqtt.client{
-- code below does both, sleeping, and writing (implicit in 'publish')
copas.addthread(function()
for i = 1, num_pings do
copas.sleep(delay)
copas.pause(delay)
print("ping", i)
assert(self:publish{ topic = "luamqtt/copas-ping/"..suffix, payload = "ping"..i, qos = 1 })
end
Expand Down
2 changes: 1 addition & 1 deletion mqtt/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ end
-- if not my_client then
-- return -- exiting, client was destroyed
-- end
-- copas.sleep(my_client:check_keep_alive())
-- copas.pause(my_client:check_keep_alive())
-- end
-- end)
function Client:check_keep_alive()
Expand Down
4 changes: 2 additions & 2 deletions mqtt/loop/copas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function _M.add(cl)
while client_registry[cl] do
local next_check = cl:check_keep_alive()
if next_check > 0 then
copas.sleep(next_check)
copas.pause(next_check)
end
end
end, cl.opts.id .. ":keep_alive")
Expand All @@ -56,7 +56,7 @@ function _M.add(cl)
copas.wakeup(timer)
else
if timeout > 0 then
copas.sleep(timeout)
copas.pause(timeout)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/08-copas_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("copas connector", function()
return
end
if timeout > 0 then
copas.sleep(timeout)
copas.pause(timeout)
end
end
end)
Expand Down

0 comments on commit ed710fc

Please sign in to comment.