Add a timeout to the update polling.
This commit is contained in:
		
							parent
							
								
									d02b25d026
								
							
						
					
					
						commit
						1183ee7bc7
					
				@ -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" },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user