mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +03:00
SyncEngine: Avoid transaction warning
This commit is contained in:
parent
04b62b139d
commit
2de22b408b
3 changed files with 12 additions and 1 deletions
|
@ -618,7 +618,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
|
|||
return;
|
||||
} else {
|
||||
// Commits a possibly existing (should not though) transaction and starts a new one for the propagate phase
|
||||
_journal->commit("pre Propagate");
|
||||
_journal->commitIfNeededAndStartNewTransaction("Post discovery");
|
||||
}
|
||||
|
||||
if( csync_reconcile(_csync_ctx) < 0 ) {
|
||||
|
|
|
@ -1046,6 +1046,16 @@ void SyncJournalDb::commit(const QString& context, bool startTrans)
|
|||
commitInternal(context, startTrans);
|
||||
}
|
||||
|
||||
void SyncJournalDb::commitIfNeededAndStartNewTransaction(const QString &context)
|
||||
{
|
||||
QMutexLocker lock(&_mutex);
|
||||
if( _transaction == 1 ) {
|
||||
commitInternal(context, true);
|
||||
} else {
|
||||
startTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SyncJournalDb::commitInternal(const QString& context, bool startTrans )
|
||||
{
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
* Commit will actually commit the transaction and create a new one.
|
||||
*/
|
||||
void commit(const QString &context, bool startTrans = true);
|
||||
void commitIfNeededAndStartNewTransaction(const QString &context);
|
||||
|
||||
void close();
|
||||
|
||||
|
|
Loading…
Reference in a new issue