From cbaf1c3556c61bdd081574589f543d04e1e45082 Mon Sep 17 00:00:00 2001 From: Christopher Hoskin Date: Thu, 1 Jun 2023 15:36:32 +0100 Subject: [PATCH] Merge pull request #13256 from overleaf/csh-issue-13004-max-retries Increase the maximum retries for the delete-old-history-chunks cron job GitOrigin-RevId: 8054ac76bbae24d0a3ba032c50c9647c044aef27 --- libraries/object-persistor/src/GcsPersistor.js | 9 ++++++++- .../history-v1/config/custom-environment-variables.json | 3 +++ services/history-v1/storage/lib/persistor.js | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/object-persistor/src/GcsPersistor.js b/libraries/object-persistor/src/GcsPersistor.js index 7271745637..1bf6c05a15 100644 --- a/libraries/object-persistor/src/GcsPersistor.js +++ b/libraries/object-persistor/src/GcsPersistor.js @@ -15,7 +15,14 @@ module.exports = class GcsPersistor extends AbstractPersistor { // endpoint settings will be null by default except for tests // that's OK - GCS uses the locally-configured service account by default - this.storage = new Storage(this.settings.endpoint) + const storageOptions = {} + if (this.settings.endpoint) { + storageOptions.projectId = this.settings.endpoint.projectId + storageOptions.apiEndpoint = this.settings.endpoint.apiEndpoint + } + storageOptions.retryOptions = this.settings.retryOptions + + this.storage = new Storage(storageOptions) } async sendFile(bucketName, key, fsPath) { diff --git a/services/history-v1/config/custom-environment-variables.json b/services/history-v1/config/custom-environment-variables.json index bb7d752288..ff9cac16e1 100644 --- a/services/history-v1/config/custom-environment-variables.json +++ b/services/history-v1/config/custom-environment-variables.json @@ -19,6 +19,9 @@ "endpoint": { "apiEndpoint": "GCS_API_ENDPOINT", "projectId": "GCS_PROJECT_ID" + }, + "retryOptions": { + "maxRetries": "GCS_MAX_RETRIES" } }, "fallback": { diff --git a/services/history-v1/storage/lib/persistor.js b/services/history-v1/storage/lib/persistor.js index d24af7d292..138e826c3c 100644 --- a/services/history-v1/storage/lib/persistor.js +++ b/services/history-v1/storage/lib/persistor.js @@ -19,6 +19,7 @@ convertKey('gcs.unlockBeforeDelete', s => s === 'true') convertKey('gcs.unsignedUrls', s => s === 'true') convertKey('gcs.signedUrlExpiryInMs', s => parseInt(s, 10)) convertKey('gcs.deleteConcurrency', s => parseInt(s, 10)) +convertKey('gcs.retryOptions.maxRetries', s => parseInt(s, 10)) convertKey('fallback.buckets', s => JSON.parse(s || '{}')) persistorConfig.Metrics = metrics