Skip to content

Commit f176034

Browse files
committed
fix(copas) switch to pause instead of sleep
1 parent 692eb23 commit f176034

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

examples/copas-example.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ local ping = mqtt.client{
2929
-- code below does both, sleeping, and writing (implicit in 'publish')
3030
copas.addthread(function()
3131
for i = 1, num_pings do
32-
copas.sleep(delay)
32+
copas.pause(delay)
3333
print("ping", i)
3434
assert(self:publish{ topic = "luamqtt/copas-ping/"..suffix, payload = "ping"..i, qos = 1 })
3535
end

mqtt/client.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ end
898898
-- if not my_client then
899899
-- return -- exiting, client was destroyed
900900
-- end
901-
-- copas.sleep(my_client:check_keep_alive())
901+
-- copas.pause(my_client:check_keep_alive())
902902
-- end
903903
-- end)
904904
function Client:check_keep_alive()

mqtt/loop/copas.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function _M.add(cl)
4141
while client_registry[cl] do
4242
local next_check = cl:check_keep_alive()
4343
if next_check > 0 then
44-
copas.sleep(next_check)
44+
copas.pause(next_check)
4545
end
4646
end
4747
end, cl.opts.id .. ":keep_alive")
@@ -56,7 +56,7 @@ function _M.add(cl)
5656
copas.wakeup(timer)
5757
else
5858
if timeout > 0 then
59-
copas.sleep(timeout)
59+
copas.pause(timeout)
6060
end
6161
end
6262
end

tests/spec/08-copas_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe("copas connector", function()
5858
return
5959
end
6060
if timeout > 0 then
61-
copas.sleep(timeout)
61+
copas.pause(timeout)
6262
end
6363
end
6464
end)

0 commit comments

Comments
 (0)