Merge lp:~mzanetti/reminders-app/remove-stale-lock-files into lp:reminders-app

Proposed by Michael Zanetti on 2016-04-29
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„ on 2016-04-29
Approved revision: 551
Merged at revision: 551
Proposed branch: lp:~mzanetti/reminders-app/remove-stale-lock-files
Merge into: lp:reminders-app
Diff against target: 17 lines (+7/-0)
1 file modified
src/libqtevernote/notesstore.cpp (+7/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/remove-stale-lock-files
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve on 2016-04-29
Alan Pope 🍺🐧🐱 πŸ¦„ 2016-04-29 Approve on 2016-04-29
Review via email: mp+293355@code.launchpad.net

Commit Message

Cleanup stale .lock files.

This might happen if the app is stopped in the middle of processing a note
and would cause it to wait for the lock release forever on next startup.

To post a comment you must log in.

Tested and this recovers from the stale lock file issue. Thanks for the fix!

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/libqtevernote/notesstore.cpp'
2--- src/libqtevernote/notesstore.cpp 2015-11-02 20:26:37 +0000
3+++ src/libqtevernote/notesstore.cpp 2016-04-29 07:58:21 +0000
4@@ -107,6 +107,13 @@
5 m_username = username;
6 emit usernameChanged();
7
8+ QDir storageDir(storageLocation());
9+ foreach (const QString &fileName, storageDir.entryList({"*.lock"})) {
10+ qCDebug(dcNotesStore) << "Removing stale lock file" << storageLocation() + "/" + fileName;
11+ QFile f(storageLocation() + "/" + fileName);
12+ f.remove();
13+ }
14+
15 m_cacheFile = storageLocation() + "notes.cache";
16 qCDebug(dcNotesStore) << "Initialized cacheFile:" << m_cacheFile;
17 loadFromCacheFile();

Subscribers

People subscribed via source and target branches