From a67e138d4e665ae38b40dc8227953beb9591595c Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 19 Mar 2025 15:03:37 -0700 Subject: [PATCH] Fix data-race with ReturnCode objects in Sqlite::DoExpire --- src/storage/backend/sqlite/SQLite.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/storage/backend/sqlite/SQLite.cc b/src/storage/backend/sqlite/SQLite.cc index e08ced3f33..f861c82657 100644 --- a/src/storage/backend/sqlite/SQLite.cc +++ b/src/storage/backend/sqlite/SQLite.cc @@ -237,12 +237,18 @@ OperationResult SQLite::DoErase(ResultCallback* cb, ValPtr key) { void SQLite::DoExpire(double current_network_time) { auto stmt = expire_stmt.get(); - if ( auto res = CheckError(sqlite3_bind_double(stmt, 1, current_network_time)); res.code != ReturnCode::SUCCESS ) { - sqlite3_reset(stmt); - // TODO: do something with the error here? + int status = sqlite3_bind_double(stmt, 1, current_network_time); + if ( status != SQLITE_OK ) { + // TODO: do something with the error? + } + else { + status = sqlite3_step(stmt); + if ( status != SQLITE_ROW ) { + // TODO: should this return an error somehow? Reporter warning? + } } - Step(stmt, false); + sqlite3_reset(stmt); } // returns true in case of error