mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 16:17:03 +00:00
feat(GODT-2364): wait and retry once if the gRPC service config file exists but cannot be opened.
This commit is contained in:
@ -78,10 +78,13 @@ bool GRPCConfig::load(QString const &path, QString *outError) {
|
|||||||
try {
|
try {
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
throw Exception("The file service configuration file does not exist.");
|
throw Exception("The gRPC service configuration file does not exist.");
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
throw Exception("The file exists but cannot be opened.");
|
QThread::msleep(500); // we wait a bit and retry once, just in case server is not done writing/moving the config file.
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
throw Exception("The gRPC service configuration file exists but cannot be opened.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonDocument const doc = QJsonDocument::fromJson(file.readAll());
|
QJsonDocument const doc = QJsonDocument::fromJson(file.readAll());
|
||||||
|
|||||||
Reference in New Issue
Block a user