Commit dc8fbae9 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

SqliteTools: Don't retry forever when the db is busy

parent 2d69edad
...@@ -146,6 +146,7 @@ public: ...@@ -146,6 +146,7 @@ public:
Row row() Row row()
{ {
auto maxRetries = 10;
while ( true ) while ( true )
{ {
auto res = sqlite3_step( m_stmt.get() ); auto res = sqlite3_step( m_stmt.get() );
...@@ -154,7 +155,7 @@ public: ...@@ -154,7 +155,7 @@ public:
else if ( res == SQLITE_DONE ) else if ( res == SQLITE_DONE )
return Row(); return Row();
else if ( res == SQLITE_BUSY && ( Transaction::transactionInProgress() == false || else if ( res == SQLITE_BUSY && ( Transaction::transactionInProgress() == false ||
m_isCommit == true ) ) m_isCommit == true ) && maxRetries-- > 0 )
continue; continue;
std::string errMsg = sqlite3_errmsg( m_dbConn ); std::string errMsg = sqlite3_errmsg( m_dbConn );
switch ( res ) switch ( res )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment