Updated stuff
This commit is contained in:
@@ -2,6 +2,7 @@ import { promises as fs } from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const DEFAULT_MAX_BACKUPS = Number.parseInt(process.env.DATA_FILE_BACKUP_MAX || '40', 10)
|
||||
let backupSequence = 0
|
||||
|
||||
function getProjectRoot() {
|
||||
const cwd = process.cwd()
|
||||
@@ -30,8 +31,9 @@ function sanitizeFileKey(filePath) {
|
||||
}
|
||||
|
||||
function buildBackupName(date = new Date()) {
|
||||
const sequence = (backupSequence++).toString(36).padStart(6, '0')
|
||||
const randomSuffix = Math.random().toString(36).slice(2, 8)
|
||||
return `${date.toISOString().replace(/[:.]/g, '-')}-${randomSuffix}.bak`
|
||||
return `${date.toISOString().replace(/[:.]/g, '-')}-${sequence}-${randomSuffix}.bak`
|
||||
}
|
||||
|
||||
export function resolveDataFileBackupPath(backupDir, backupName) {
|
||||
|
||||
Reference in New Issue
Block a user