Safely check for out of date databases
When checking to re-import test databases, if the target database is missing or otherwise unavailable, avoid the check and just continue. This avoids a bug where a user would delete a test database and there would be an error when trying to run a query.
This commit is contained in:
Родитель
752ec04400
Коммит
d57255152c
|
@ -227,8 +227,16 @@ export class DatabaseManager extends DisposableObject {
|
|||
"codeql-database.yml",
|
||||
);
|
||||
|
||||
let originStat;
|
||||
try {
|
||||
originStat = await stat(originDbYml);
|
||||
} catch (e) {
|
||||
// if there is an error here, assume that the origin database
|
||||
// is no longer available. Safely ignore and do not try to re-import.
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const originStat = await stat(originDbYml);
|
||||
const importedStat = await stat(importedDbYml);
|
||||
return originStat.mtimeMs > importedStat.mtimeMs;
|
||||
} catch (e) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче