From: Brian Candler Date: 2010-07-14T06:10:38+09:00 Subject: Re: yahoo finance api:Timeout::Error: execution expired Pen Ttt wrote: > i want to download usa stock quote data via ruby-yahoo finance api, > here is my program: I don't know anything about the Yahoo Finance API, but I know that if I were running such a public service, I would probably include some protection against one person trying to hit it 6000 times repeatedly. Are you sure you're using the right API call to do what you want? OTOH, a quick search suggests that Yahoo rate limiting is typically done over a larger period: http://developer.yahoo.com/search/rate.html Anyway, I'd suggest you try the following: (1) Re-order the list of companies you search. Does it always barf on the same one, or always the 10th in the list? (2) Insert a "sleep 1" into the loop, see if the problem goes away (3) Check that the YahooFinance client module is properly closing each socket, by using "netstat -n" in another window, and checking how many sockets are in ESTABLISHED state. If there are lots of ESTABLISHED sockets then the client code isn't closing sockets, and the server may have a limit on the number of concurrent requests from the same IP. -- Posted via http://www.ruby-forum.com/.