diff --git a/package.json b/package.json index fe65bc6..5ebe0d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tracker-utils", - "version": "1.6.11", + "version": "1.6.12", "description": "Tracker Utils", "main": "index.js", "scripts": { @@ -17,7 +17,7 @@ }, "dependencies": { "@google-cloud/pubsub": "^4.7.2", - "@google-cloud/storage": "^5.16.1", + "@google-cloud/storage": "^7.19.0", "axios": "^1.7.7", "bluebird": "^3.5.0", "ejs": "^3.1.6", diff --git a/src/cloudstorage.js b/src/cloudstorage.js index 0099b2a..863f0ea 100644 --- a/src/cloudstorage.js +++ b/src/cloudstorage.js @@ -1,5 +1,12 @@ // External and built-in deps const { Storage } = require('@google-cloud/storage'); +const gcpUploadRetryOpt = { + autoRetry: true, + maxRetries: 5, + retryDelayMultiplier: 2, + totalTimeout: 120000, // 120 seconds + maxRetryDelay: 30000 // 30 seconds +}; /** * Note: Environment should have GOOGLE_APPLICATION_CREDENTIALS set up. This has the path of service @@ -21,7 +28,7 @@ class CloudStorage { this.type = type; this.baseUrl = baseUrl; // TODO: Update this in future when aws will be used. - this.storage = new Storage(); + this.storage = new Storage({retryOptions: gcpUploadRetryOpt}); } /**