ruby - Net::OpenTimeout: execution expired on background third party API call -


i have sidekiq 5 workers, concurrency 50. webapp make third party api calls every few minutes, averagely 15000 requests per hour. each hour have near 10 errors net::opentimeout: execution expired. looks not big problem, want know how deal it. thanks.

def grabber(url)     response, body = nil     uri = uri(url)     net::http.start(uri.host, uri.port,                     :use_ssl => uri.scheme == 'https', :read_timeout => 1000) |http|       request = net::http::get.new uri        response = http.request request     end     if response.code == '200'       body = json.parse(response.body)     end     body   end 

net::http throws exception when request time out occurs.

you can catch exceptions , it:

rescue net::opentimeout   #do 

here can examples.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -