Fix data-race with ReturnCode objects in Sqlite::DoExpire

This commit is contained in:
Tim Wojtulewicz 2025-03-19 15:03:37 -07:00
parent 8b9fe48f13
commit a67e138d4e

View file

@ -237,12 +237,18 @@ OperationResult SQLite::DoErase(ResultCallback* cb, ValPtr key) {
void SQLite::DoExpire(double current_network_time) { void SQLite::DoExpire(double current_network_time) {
auto stmt = expire_stmt.get(); auto stmt = expire_stmt.get();
if ( auto res = CheckError(sqlite3_bind_double(stmt, 1, current_network_time)); res.code != ReturnCode::SUCCESS ) { int status = sqlite3_bind_double(stmt, 1, current_network_time);
sqlite3_reset(stmt); if ( status != SQLITE_OK ) {
// TODO: do something with the error here? // 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 // returns true in case of error