Merge pull request #1638 from github/aeisenberg/persist-dbs
Fix bug where dbs are lost on restart
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## [UNRELEASED]
|
||||
|
||||
- Fix a bug where databases may be lost if VS Code is restarted while the extension is being started up. [#1638](https://github.com/github/vscode-codeql/pull/1638)
|
||||
- Add commands for navigating up, down, left, or right in the result viewer. Previously there were only commands for moving up and down the currently-selected path. We suggest binding keyboard shortcuts to these commands, for navigating the result viewer using the keyboard. [#1568](https://github.com/github/vscode-codeql/pull/1568)
|
||||
|
||||
## 1.7.2 - 14 October 2022
|
||||
|
||||
@@ -684,7 +684,9 @@ export class DatabaseManager extends DisposableObject {
|
||||
this._onDidChangeDatabaseItem.fire(event);
|
||||
});
|
||||
|
||||
await this.addDatabaseItem(progress, token, item);
|
||||
// Avoid persisting the database state after adding since that should happen only after
|
||||
// all databases have been added.
|
||||
await this.addDatabaseItem(progress, token, item, false);
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -724,6 +726,7 @@ export class DatabaseManager extends DisposableObject {
|
||||
void this.logger.log(`Error loading database ${database.uri}: ${e}.`);
|
||||
}
|
||||
}
|
||||
await this.updatePersistedDatabaseList();
|
||||
} catch (e) {
|
||||
// database list had an unexpected type - nothing to be done?
|
||||
void showAndLogErrorMessage(`Database list loading failed: ${getErrorMessage(e)}`);
|
||||
@@ -784,10 +787,14 @@ export class DatabaseManager extends DisposableObject {
|
||||
private async addDatabaseItem(
|
||||
progress: ProgressCallback,
|
||||
token: vscode.CancellationToken,
|
||||
item: DatabaseItem
|
||||
item: DatabaseItem,
|
||||
updatePersistedState = true
|
||||
) {
|
||||
this._databaseItems.push(item);
|
||||
await this.updatePersistedDatabaseList();
|
||||
|
||||
if (updatePersistedState) {
|
||||
await this.updatePersistedDatabaseList();
|
||||
}
|
||||
|
||||
// Add this database item to the allow-list
|
||||
// Database items reconstituted from persisted state
|
||||
|
||||
Reference in New Issue
Block a user