fix(electron): enable WAL mode for sqlite (#8336)

fix AF-1015
This commit is contained in:
pengx17
2024-09-25 04:06:03 +00:00
parent e6feb17ac7
commit e839947dd5
6 changed files with 36 additions and 3 deletions

View File

@@ -141,6 +141,18 @@ export class SQLiteAdapter {
}
}
async checkpoint() {
try {
if (!this.db) {
logger.warn(`${this.path} is not connected`);
return;
}
await this.db.checkpoint();
} catch (error) {
logger.error('checkpoint', error);
}
}
async getUpdatesCount(docId?: string) {
try {
if (!this.db) {

View File

@@ -120,6 +120,10 @@ export class WorkspaceSQLiteDB {
}
return null;
};
async checkpoint() {
await this.adapter.checkpoint();
}
}
export async function openWorkspaceDatabase(

View File

@@ -77,6 +77,7 @@ export async function saveDBFileAs(
): Promise<SaveDBFileResult> {
try {
const db = await ensureSQLiteDB('workspace', workspaceId);
await db.checkpoint(); // make sure all changes (WAL) are written to db
const fakedResult = getFakedResult();
const ret =

View File

@@ -98,8 +98,6 @@ export const registerUpdater = async () => {
channel: buildType,
});
logger.debug('auto-updater feed config', feedUrl);
autoUpdater.setFeedURL(feedUrl);
// register events for checkForUpdates