How to increase the read_timeout for a request?

I have created a request like this:
request = Sketchup::Http::Request.new(OPTMIZE_URL, Sketchup::Http::POST)

How could I increase the read_timeout property ? Since my request take more than 60 secs to complete.

Is Sketchup::Http::STATUS_FAILED returned in the #start block after 60 seconds ?

(Ping @thomthom )

You mean it takes longer than 60 secs for the server to respond?
Because, if there is a response, and the actual download lasts for longer - then there should be no timeout.

I’ll assume you are referring to timeouts when server doesn’t respond. I asked another team member who’s more familiar with Chromium and he said there is no timeout on our end. And from what he could tell, there was no support for this in Chromium either, citing these references:

https://magpcss.org/ceforum/viewtopic.php?f=6&t=13080&p=26290&hilit=request+timeout#p28392

1 Like

For long-lasting server processes, it’s better to make them asynchronous instead of assuming/requiring that the client is implemented in a certain way.
Make the server start a process/thread and return immediately a generated URL where the client will be able to fetch the result (like from a simple storage server e.g. Redis).
Make the client poll this URL until the result is there, and then download it.

1 Like

Thanks guys. Need to change the logic.

Server is responding after 5 mins but request is not responding to the response.
It seems request is closing and not responding to the response.

You need to reference the request using a persistent Ruby reference that will not go out of scope and get garbage collected by Ruby.

This usually means a instance variable.