mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-17 14:00:36 -04:00
Significantly reduce impact of FileWatcher hashing (#3724)
* Fix #3699 Reduce file watch hashing of open database files from every second to every 30 seconds. Additionally, only hash the first 1024 bytes of the database file. This is valid since most of the header and the entire encrypted portion are changed significantly on every save.
This commit is contained in:
parent
178bea6bbc
commit
36e14157be
3 changed files with 17 additions and 7 deletions
|
@ -158,7 +158,7 @@ bool Database::open(const QString& filePath, QSharedPointer<const CompositeKey>
|
|||
|
||||
m_initialized = true;
|
||||
emit databaseOpened();
|
||||
m_fileWatcher->start(canonicalFilePath());
|
||||
m_fileWatcher->start(canonicalFilePath(), 30, 1);
|
||||
setEmitModified(true);
|
||||
|
||||
return true;
|
||||
|
@ -234,7 +234,7 @@ bool Database::saveAs(const QString& filePath, QString* error, bool atomic, bool
|
|||
bool ok = performSave(canonicalFilePath, error, atomic, backup);
|
||||
if (ok) {
|
||||
setFilePath(filePath);
|
||||
m_fileWatcher->start(canonicalFilePath);
|
||||
m_fileWatcher->start(canonicalFilePath, 30, 1);
|
||||
} else {
|
||||
// Saving failed, don't rewatch file since it does not represent our database
|
||||
markAsModified();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue