Kushal
Kushal

Reputation: 218

Koala Facebook for Rails

How to raise timeout error using koala gem for Facebook in Rails ?

if anybody knows, please let me know.

Upvotes: 0

Views: 396

Answers (2)

Nando
Nando

Reputation: 747

The best way to do that is: Koala.http_service.http_options = {request: {open_timeout: 1, timeout: 1}}

Upvotes: 0

Малъ Скрылевъ
Малъ Скрылевъ

Reputation: 16507

You can use ruby's Timeout module as follows:

require 'timeout'
begin
   status = Timeout::timeout(5) do
      @koala_api.get_connection 'me', :feed
   end
rescue Timeout::Error
   # do something on timeout
end

Upvotes: 2

Related Questions