From be1ee939eeabb784bf34e7926604e090a3ddaf67 Mon Sep 17 00:00:00 2001 From: Adrian Perez de Castro Date: Sun, 5 Feb 2017 13:50:40 +0100 Subject: [PATCH] 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. --- matrix/client.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matrix/client.lua b/matrix/client.lua index 82de2fe..5f10cc3 100644 --- a/matrix/client.lua +++ b/matrix/client.lua @@ -465,9 +465,9 @@ function Client:sync(stop, timeout) if not stop then stop = return_false end - while not stop(self) do + repeat self:_sync { timeout = timeout or 15000 } - end + until stop(self) end function Client:_sync_handle_room__join(room_id, data)