Make :sync() call the API endpoint always at least once

Othewise it could happen that a request to /sync would not be done even
once depending on how the "stop" callback is defined.
This commit is contained in:
Adrian Perez de Castro
2017-02-05 13:50:40 +01:00
parent ae18e3374d
commit be1ee939ee

View File

@@ -465,9 +465,9 @@ function Client:sync(stop, timeout)
if not stop then if not stop then
stop = return_false stop = return_false
end end
while not stop(self) do repeat
self:_sync { timeout = timeout or 15000 } self:_sync { timeout = timeout or 15000 }
end until stop(self)
end end
function Client:_sync_handle_room__join(room_id, data) function Client:_sync_handle_room__join(room_id, data)