overleaf/services/history-v1/storage/lib/persistor.js
Christopher Hoskin cbaf1c3556 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
2023-06-02 08:07:17 +00:00

27 lines
998 B
JavaScript

const _ = require('lodash')
const config = require('config')
const metrics = require('./metrics')
const objectPersistor = require('@overleaf/object-persistor')
const persistorConfig = _.cloneDeep(config.get('persistor'))
function convertKey(key, convertFn) {
if (_.has(persistorConfig, key)) {
_.update(persistorConfig, key, convertFn)
}
}
convertKey('s3.signedUrlExpiryInMs', s => parseInt(s, 10))
convertKey('s3.httpOptions.timeout', s => parseInt(s, 10))
convertKey('s3.maxRetries', s => parseInt(s, 10))
convertKey('s3.pathStyle', s => s === 'true')
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
module.exports = objectPersistor(persistorConfig)