diff --git a/src/engine/transaction.h b/src/engine/transaction.h --- a/src/engine/transaction.h +++ b/src/engine/transaction.h @@ -95,7 +95,7 @@ // // Transaction handling // - void commit(); + bool commit(); void abort(); bool hasChanges() const; diff --git a/src/engine/transaction.cpp b/src/engine/transaction.cpp --- a/src/engine/transaction.cpp +++ b/src/engine/transaction.cpp @@ -293,12 +293,12 @@ m_writeTrans->replaceDocument(doc, operations); } -void Transaction::commit() +bool Transaction::commit() { Q_ASSERT(m_txn); if (!m_writeTrans) { qCWarning(ENGINE) << "m_writeTrans is null"; - return; + return false; } m_writeTrans->commit(); @@ -311,6 +311,7 @@ } m_txn = nullptr; + return rc == 0; } void Transaction::abort() diff --git a/src/file/extractor/app.cpp b/src/file/extractor/app.cpp --- a/src/file/extractor/app.cpp +++ b/src/file/extractor/app.cpp @@ -116,7 +116,7 @@ QTimer::singleShot(delay, this, &App::processNextFile); } else { - m_tr->commit(); + bool rc = m_tr->commit(); delete m_tr; m_tr = nullptr; @@ -139,7 +139,12 @@ // Enable the SocketNotifier for the next batch m_notifyNewData.setEnabled(true); - m_outputStream << "B" << endl; + if (rc) { + m_outputStream << "B" << endl; + } else { + qCritical() << "Could not commit results. Quitting"; + QCoreApplication::exit(-1); + } } }