lib/telegram/bot/client.rb in telegram-bot-ruby-0.3.0 vs lib/telegram/bot/client.rb in telegram-bot-ruby-0.3.1

- old
+ new

@@ -1,8 +1,11 @@ module Telegram module Bot class Client + TIMEOUT_EXCEPTIONS = [Timeout::Error] + TIMEOUT_EXCEPTIONS << Net::ReadTimeout if Net.const_defined?(:ReadTimeout) + attr_reader :api, :offset, :timeout, :logger def self.run(*args, &block) new(*args).run(&block) end @@ -29,10 +32,10 @@ @offset = update.update_id.next log_incoming_message(update.message) yield update.message end end - rescue Net::ReadTimeout + rescue *TIMEOUT_EXCEPTIONS retry end private