You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Cli: Fix last change sometimes lost when not in TUI mode (#13090)
This commit is contained in:
@@ -432,6 +432,7 @@ class Application extends BaseApplication {
|
||||
}
|
||||
|
||||
await Setting.saveAll();
|
||||
await this.database_.close();
|
||||
|
||||
// Need to call exit() explicitly, otherwise Node wait for any timeout to complete
|
||||
// https://stackoverflow.com/questions/18050095
|
||||
|
||||
@@ -90,8 +90,7 @@ export default class BaseApplication {
|
||||
private eventEmitter_: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
private scheduleAutoAddResourcesIID_: any = null;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
private database_: any = null;
|
||||
protected database_: JoplinDatabase = null;
|
||||
private profileConfig_: ProfileConfig = null;
|
||||
|
||||
protected showStackTraces_ = false;
|
||||
|
||||
@@ -16,6 +16,12 @@ class DatabaseDriverNode {
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
return new Promise(resolve => {
|
||||
this.db_.close(() => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
sqliteErrorToJsError(error, sql = null, params = null) {
|
||||
const msg = [error.toString()];
|
||||
if (sql) msg.push(sql);
|
||||
|
||||
@@ -65,6 +65,14 @@ export default class Database {
|
||||
this.logger().info('Database was open successfully');
|
||||
}
|
||||
|
||||
public async close() {
|
||||
try {
|
||||
await this.driver().close?.();
|
||||
} catch (error) {
|
||||
this.logger().warn('Failed to close database', error);
|
||||
}
|
||||
}
|
||||
|
||||
public escapeField(field: string) {
|
||||
if (field === '*') return '*';
|
||||
const p = field.split('.');
|
||||
|
||||
Reference in New Issue
Block a user