feat: adds support for allowing backups of unlimited size

This commit is contained in:
Andrew Leonard 2024-07-15 23:58:05 -04:00
parent b1bc472205
commit 2bc949fae3
No known key found for this signature in database
2 changed files with 14 additions and 13 deletions

View file

@ -42,7 +42,7 @@ class BackupManager {
}
get maxBackupSize() {
return global.ServerSettings.maxBackupSize || 1
return global.ServerSettings.maxBackupSize || Infinity
}
async init() {
@ -419,14 +419,16 @@ class BackupManager {
reject(err)
})
archive.on('progress', ({ fs: fsobj }) => {
const maxBackupSizeInBytes = this.maxBackupSize * 1000 * 1000 * 1000
if (fsobj.processedBytes > maxBackupSizeInBytes) {
Logger.error(`[BackupManager] Archiver is too large - aborting to prevent endless loop, Bytes Processed: ${fsobj.processedBytes}`)
archive.abort()
setTimeout(() => {
this.removeBackup(backup)
output.destroy('Backup too large') // Promise is reject in write stream error evt
}, 500)
if (this.maxBackupSize !== Infinity) {
const maxBackupSizeInBytes = this.maxBackupSize * 1000 * 1000 * 1000
if (fsobj.processedBytes > maxBackupSizeInBytes) {
Logger.error(`[BackupManager] Archiver is too large - aborting to prevent endless loop, Bytes Processed: ${fsobj.processedBytes}`)
archive.abort()
setTimeout(() => {
this.removeBackup(backup)
output.destroy('Backup too large') // Promise is reject in write stream error evt
}, 500)
}
}
})