Page MenuHomePhabricator

D4262.diff
No OneTemporary

D4262.diff

diff --git a/keyserver/src/cron/backups.js b/keyserver/src/cron/backups.js
--- a/keyserver/src/cron/backups.js
+++ b/keyserver/src/cron/backups.js
@@ -16,9 +16,18 @@
const lstat = promisify(fs.lstat);
const unlink = promisify(fs.unlink);
+type BackupConfig = {
+ +enabled: boolean,
+ +directory: string,
+};
+
+function getBackupConfig(): Promise<?BackupConfig> {
+ return importJSON({ folder: 'facts', name: 'backups' });
+}
+
async function backupDB() {
const [backupConfig, dbConfig] = await Promise.all([
- importJSON({ folder: 'facts', name: 'backups' }),
+ getBackupConfig(),
getDBConfig(),
]);
@@ -185,7 +194,7 @@
}
async function deleteOldestBackup() {
- const backupConfig = await importJSON({ folder: 'facts', name: 'backups' });
+ const backupConfig = await getBackupConfig();
invariant(backupConfig, 'backupConfig should be non-null');
const files = await readdir(backupConfig.directory);
let oldestFile;

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 11:18 PM (19 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598560
Default Alt Text
D4262.diff (960 B)

Event Timeline