Skip to content

Commit

Permalink
Catch early exceptions in runCorruptionChecks
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and indutny-signal committed Nov 15, 2023
1 parent 8269c59 commit 0f33fcc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ts/sql/Server.ts
Expand Up @@ -5216,7 +5216,16 @@ async function getAllBadgeImageFileLocalPaths(): Promise<Set<string>> {
}

function runCorruptionChecks(): void {
const db = getUnsafeWritableInstance('integrity check');
let db: Database;
try {
db = getUnsafeWritableInstance('integrity check');
} catch (error) {
logger.error(
'runCorruptionChecks: not running the check, no writable instance',
Errors.toLogFormat(error)
);
return;
}
try {
const result = db.pragma('integrity_check');
if (result.length === 1 && result.at(0)?.integrity_check === 'ok') {
Expand Down

0 comments on commit 0f33fcc

Please sign in to comment.