mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
* Reduce I/O pressure on SQLite DB Operations * Update allow.txt - add autocheckpoint
This commit is contained in:
parent
6e5e83843d
commit
95938807b0
3 changed files with 6 additions and 3 deletions
1
.github/actions/spelling/allow.txt
vendored
1
.github/actions/spelling/allow.txt
vendored
|
|
@ -36,6 +36,7 @@ AThings
|
|||
attrnamespace
|
||||
aufxw
|
||||
aur
|
||||
autocheckpoint
|
||||
autoclean
|
||||
automake
|
||||
autoprocess
|
||||
|
|
|
|||
|
|
@ -317,6 +317,8 @@ final class ItemDatabase {
|
|||
// Set the journal mode for databases associated with the current connection
|
||||
// https://www.sqlite.org/pragma.html#pragma_journal_mode
|
||||
db.exec("PRAGMA journal_mode = WAL;");
|
||||
// Only checkpoint if WAL grows past a certain size
|
||||
db.exec("PRAGMA wal_autocheckpoint = 1000;");
|
||||
// Automatic indexing is enabled by default as of version 3.7.17
|
||||
// https://www.sqlite.org/pragma.html#pragma_automatic_index
|
||||
// PRAGMA automatic_index = boolean;
|
||||
|
|
@ -1214,8 +1216,8 @@ final class ItemDatabase {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure there are no pending operations by performing a checkpoint
|
||||
db.exec("PRAGMA wal_checkpoint(TRUNCATE);");
|
||||
// Ensure there are no pending operations by performing a PASSIVE checkpoint
|
||||
db.exec("PRAGMA wal_checkpoint(PASSIVE);");
|
||||
|
||||
// Prepare and execute VACUUM statement
|
||||
Statement stmt = db.prepare("VACUUM;");
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ int main(string[] cliArgs) {
|
|||
|
||||
// Write WAL and SHM data to file for this loop and release memory used by in-memory processing
|
||||
if (debugLogging) {addLogEntry("Merge contents of WAL and SHM files into main database file", ["debug"]);}
|
||||
itemDB.performCheckpoint("TRUNCATE");
|
||||
itemDB.performCheckpoint("PASSIVE");
|
||||
} else {
|
||||
// Not online
|
||||
addLogEntry("Microsoft OneDrive service is not reachable at this time. Will re-try on next sync attempt.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue