Hi
i have written a script which connects to a website and read from their
but some time that website is soo slow that it gets time out .
so i have done this
begin
response = http.request(request)
code=response.code
log_info(“Response Code - #{code}”)
end until response.code == “200”
But it gets time out … now i can increase the http time out but thats
not a solution
is not there any way that i can do …
As long as response.code == 200, it will keep try to get request without
producing time out or any error…
i thought the code i wrote it will do that job , but it does not …
where i am doing wrong ??
or how can i get what i am looking for ??
As long as response.code == 200, it will keep try to get request without
producing time out or any error…
i thought the code i wrote it will do that job , but it does not …
where i am doing wrong ??
or how can i get what i am looking for ??
With this loop, you are making a new request each time, which starts
the whole retrieval process over again. AFAIK, the only way to make
this work is by setting the timeout long enough to retrieve all the
data. What you can do is set the get request inside a begin-rescue-end
block and use a progressive timeout backoff and a retry. Limit the
number of retries so you don’t end up with an infinite loop. Robert
Klemme showed me how to do this with another sort of request in an
earlier message by passing a block to a method. I implemented it
something like this: