Add a timeout to the update polling.

This commit is contained in:
Danila Fedorin 2018-01-12 20:58:51 -08:00
parent d02b25d026
commit 1183ee7bc7
1 changed files with 3 additions and 2 deletions

View File

@ -18,8 +18,9 @@ module Telepathy
return Response(User).from_json(response.body).result
end
def get_updates
update_data = {} of String => Int64 | String
def get_updates(timeout = 0)
update_data = {} of String => Int64 | Int32 | String
update_data["timeout"] = timeout
@last_update_id.try { |id| update_data["offset"] = id }
response = HTTP::Client.get(@request_base + "/getUpdates",
headers: HTTP::Headers{"User-agent" => "Telepathy", "Content-type" => "application/json" },