mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 13:16:53 +00:00
GODT-1929: changed gRPC wait timeout.
This commit is contained in:
committed by
Romain LE JEUNE
parent
77b9cab07b
commit
2f7ce565f0
@ -41,7 +41,7 @@ namespace
|
||||
|
||||
QString const bridgeLock = "bridge-gui.lock"; ///< file name used for the lock file.
|
||||
QString const exeName = "bridge" + exeSuffix; ///< The bridge executable file name.*
|
||||
qint64 const grpcServiceConfigWaitDelayMs = 60000; ///< The wait delay for the gRPC config file in milliseconds.
|
||||
qint64 const grpcServiceConfigWaitDelayMs = 180000; ///< The wait delay for the gRPC config file in milliseconds.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ namespace
|
||||
|
||||
|
||||
Empty empty; // re-used across client calls.
|
||||
int const maxConnectionTimeSecs = 60; ///< Amount of time after which we consider connection attempts to the server have failed.
|
||||
qint64 const grpcConnectionWaitTimeoutMs = 60000; ///< Timeout for the connection to the already running gRPC server in milliseconds.
|
||||
qint64 const grpcConnectionRetryDelayMs = 10000; ///< Retry delay for the gRPC connection in milliseconds.
|
||||
|
||||
|
||||
}
|
||||
@ -118,14 +119,14 @@ bool GRPCClient::connectToServer(GRPCConfig const &config, QString &outError)
|
||||
if (!stub_)
|
||||
throw Exception("Stub creation failed.");
|
||||
|
||||
QDateTime const giveUpTime = QDateTime::currentDateTime().addSecs(maxConnectionTimeSecs); // if we reach giveUpTime without connecting, we give up
|
||||
QDateTime const giveUpTime = QDateTime::currentDateTime().addMSecs(grpcConnectionWaitTimeoutMs); // if we reach giveUpTime without connecting, we give up
|
||||
int i = 0;
|
||||
while (true)
|
||||
{
|
||||
if (log_)
|
||||
log_->debug(QString("Connection to gRPC server at %1. attempt #%2").arg(address).arg(++i));
|
||||
|
||||
if (channel_->WaitForConnected(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_seconds(5, GPR_TIMESPAN))))
|
||||
if (channel_->WaitForConnected(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(grpcConnectionRetryDelayMs, GPR_TIMESPAN))))
|
||||
break; // connection established.
|
||||
|
||||
if (QDateTime::currentDateTime() > giveUpTime)
|
||||
|
||||
Reference in New Issue
Block a user