mirror of
https://github.com/zotero/zotero.git
synced 2026-10-08 03:08:19 +00:00
Wait for an open transaction before vacuuming the embeddings database
SQLite can't vacuum from within a transaction, and the idle handler that vacuums the attached database can run while other work has one open.
This commit is contained in:
parent
b45f1c751e
commit
4a70708e07
1 changed files with 3 additions and 0 deletions
|
|
@ -304,6 +304,9 @@ Zotero.Embeddings = new function () {
|
|||
* @return {Promise<Boolean>} - Whether the database was vacuumed
|
||||
*/
|
||||
this.vacuumDB = async function ({ force = false } = {}) {
|
||||
if (Zotero.DB.inTransaction()) {
|
||||
await Zotero.DB.waitForTransaction();
|
||||
}
|
||||
if (!force) {
|
||||
let freelistCount = await Zotero.DB.valueQueryAsync("PRAGMA embeddings.freelist_count");
|
||||
let pageCount = await Zotero.DB.valueQueryAsync("PRAGMA embeddings.page_count");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue