Hi
Hi,
How can I set TRestRequest.Timeout ? default value (30 000 milliseconds) keeps beeing used even when changing the value...
Looks like timeout is hardcoded somewhere.
How can I set TRestRequest.Timeout ? default value (30 000 milliseconds) keeps beeing used even when changing the value...
Looks like timeout is hardcoded somewhere.
Just found these issues :
ReplyDeletehttps://quality.embarcadero.com/browse/RSP-11624
https://quality.embarcadero.com/browse/RSP-12435
Problems exists for a while now... OMG... Embarcadero, what are you doing...
There should be a fix coming.
ReplyDeleteStéphane Wierzbicki I'm not aware of the TRestRequest class, isn't it possible to subclass and replace the 30 sec value?
ReplyDeleteMarco Cantù thank you for the info. Hope that will be fixed for all platforms.
ReplyDeleteDorin Duminica I have directly patched unit System.NET.HttpClient.Win by modifying TWinHTTPRequest.CreateHandles(const AURI: TURI) procedure. I've added this call at the begining of the method :
Begin
if not WinHttpSetTimeouts(TWinHTTPClient(FClient).FWSession,HTTP_DEFAULT_RESOLVETIMEOUT,
HTTP_DEFAULT_CONNECTTIMEOUT, HTTP_DEFAULT_SENDTIMEOUT, HTTP_DEFAULT_RECEIVETIMEOUT) then
raise ENetHTTPRequestException.Create(SysErrorMessage(GetLastError));
....
End;
For "simplifications", HTTP_DEFAULT_CONNECTTIMEOUT, HTTP_DEFAULT_SENDTIMEOUT and HTTP_DEFAULT_RECEIVETIMEOUT are declared as global variables set to 0.
Stéphane Wierzbicki
ReplyDeletehttps://quality.embarcadero.com/browse/RSP-11086
Stéphane Wierzbicki Hope you're not planning on using it for anything fancy, given that it disconnects after each request.
ReplyDeleteAsbjørn Heid I'm connecting to RESTFull webservices and only fetching or posting some JSON data.
ReplyDeleteStéphane Wierzbicki Yea just keep it in mind if you're using https, especially over the internet. You'll be limited to 1-2 calls per second.
ReplyDeleteAsbjørn Heid I wasn't aware of this. Thank you for pointing this out.
ReplyDeleteStéphane Wierzbicki I learned the hard way, had every thing set up to access Gmail via REST, with OAuth 2.0 authentication and all, but it was just soo sloow accessing the mails. I then found the culprit as mentioned...
ReplyDeleteSo for those use cases the components are unfortunately utterly useless.