You are not logged in.
Pages: 1
Hi AB.
I'm making several calls to the server rest, so I keep saved interface (MAINshd).
I would like to repeat the call automatically in case of connection failure.
var
retry: integer;
done: boolean;
Modd: TSQLModel;
CLID: TSQLHttpClient;
begin
[..]
retry: = 3;
repeat
done: = true;
try
res: = MAINshd.myInterfacedFunction ();
except
dec (retry);
MAINshd: = connc (SERVER_ADDR, user, pass, modd, CLID); // Rebuild interface
done:=retry<0;
end;
until done;
[..]
end;
It works, but I was wondering if there was a smarter way.
Keep in mind that I could reconnect to another server mORMot.
Last edited by Sabbiolina (2015-01-08 22:10:37)
Offline
Where ?
Offline
Take a look at TSQLRestClientURI.URI() for retry in case of time out.
And in THttpClientSocket.Request.
But we may have to do a retry for other client connections (like TSQLHttpClientWinINet and TSQLHttpClientWinHTTP).
Re-creating the connection without re-creating the TSQLRestClient instance is much better approach, especially when you have sicPerClient kind of service instance lifetime.
Offline
Pages: 1