Consuming a SOAP WebService with sleep time between requests

Skip to first unread message

Mauro Nidola

Jul 8, 2013, 3:41:29 AM7/8/13
Hi guys,
I'm currently using Savon ( in a rubyonrails 3.2 application running on a server with apache 2 + passenger (free version, without threads) to consume a SOAP WebService.
My application needs to fetch paged data (almost 400 pages => 400 requests) an there is a constraint on the use of the webservice: 2 seconds between each request. 
Is it possible to do that with typhoeus (Hydra module)?

Many thanks in advance for your reply.

Hans Hasselberg

Jul 10, 2013, 3:52:57 AM7/10/13

Hey Mauro,

There is no building mechanism to do that but it's quite easy to do that
with plain ruby:

requests.each {|req|; sleep 2 }

Does that help?

You received this message because you are subscribed to the Google Groups "Typhoeus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Mauro Nidola

Jul 10, 2013, 11:47:32 AM7/10/13
I use the "sleep approach" in my current implementation (based on the HTTParty gem), but it takes a lot of time to fetch the ~400 pages of data.
I'd like to save time running requests in parallel using the Hydra module, but I don't know how to force the pause of 2 seconds between parallel requests.


Hans Hasselberg

Jul 11, 2013, 3:39:12 AM7/11/13

If you are only allowed to do one request every 2seconds you cannot do
parallel requests, or am I wrong? Running two requests in parallel is
almost the same as starting two threads and run a request in each of them.
Which would also exceed the limit.

But you can use Typhoeus nevertheless. Typhoeus keeps the connection open
even for single requests which goes a long way if you request the same
server over and over again.

Reply all
Reply to author
0 new messages