changeset 252:b1473f367878

new configurations for google: MaxRetries + TransferStallTimeout
author Alain Mazy <am@orthanc.team>
date Thu, 05 Nov 2026 09:48:40 +0100
parents b3468b9abdf3
children fa8b91cb640b 1b5776af6865
files Google/GoogleStoragePlugin.cpp NEWS README.md
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Google/GoogleStoragePlugin.cpp	Mon Aug 10 10:25:51 2026 +0200
+++ b/Google/GoogleStoragePlugin.cpp	Thu Nov 05 09:48:40 2026 +0100
@@ -277,6 +277,9 @@
     return nullptr;
   }
 
+  const unsigned int transferStallTimeout = pluginSection.GetUnsignedIntegerValue("TransferStallTimeout", 120);
+  const int maxRetries = pluginSection.GetIntegerValue("MaxRetries", 10);
+
   // Use service account credentials from a JSON keyfile:
   auto creds = gcs::oauth2::CreateServiceAccountCredentialsFromJsonFilePath(pathToGoogleCredentials);
   if (!creds)
@@ -286,7 +289,11 @@
   }
 
   // Create a client to communicate with Google Cloud Storage.
-  google::cloud::StatusOr<gcs::Client> mainClient = gcs::Client(gcs::ClientOptions(*creds));
+  google::cloud::Options options;
+  options.set<gcs::Oauth2CredentialsOption>(*creds);
+  options.set<gcs::TransferStallTimeoutOption>(std::chrono::seconds(transferStallTimeout));
+  options.set<gcs::RetryPolicyOption>(std::make_shared<gcs::LimitedErrorCountRetryPolicy>(maxRetries));
+  google::cloud::StatusOr<gcs::Client> mainClient = gcs::Client(options);
 
   if (!mainClient)
   {
--- a/NEWS	Mon Aug 10 10:25:51 2026 +0200
+++ b/NEWS	Thu Nov 05 09:48:40 2026 +0100
@@ -1,3 +1,13 @@
+Pending changes
+===============
+
+* Google plugin:
+  * New configuration "TransferStallTimeout" defines the timeout (in seconds) before retrying
+    a hung transfer (default is 120).
+  * New configuration "MaxRetries" to define the number of retries for the Google HTTP Client 
+    (default is 10).
+
+
 2026-07-22 - v 2.5.4
 ====================
 
@@ -5,7 +15,7 @@
  * New configuration "MaxConnections" to define the size of the HTTP connection pool used
    by the AWS HTTP Client (default is 25).
  * New configuration "MaxRetries" to define the number of retries for the AWS HTTP Client 
-  (default is 10).
+   (default is 10).
    
 
 2026-06-22 - v 2.5.3
--- a/README.md	Mon Aug 10 10:25:51 2026 +0200
+++ b/README.md	Thu Nov 05 09:48:40 2026 +0100
@@ -44,7 +44,9 @@
         "RootPath": "",                 // optional: folder in which files are stored (ex: my/path/to/myfolder)
         "StorageEncryption" : {...},
         "StorageStructure" : "flat",
-        "MigrationFromFileSystemEnabled" : false
+        "MigrationFromFileSystemEnabled" : false,
+        "MaxRetries": 10,
+        "TransferStallTimeout": 120
     }
 
 ```