Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3385085
D4262.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
960 B
Referenced Files
None
Subscribers
None
D4262.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4262: [keyserver] Type BackupConfig
Attached
Detach File
Event Timeline
Log In to Comment