SQLite: Fix some issues with expiration, including in the btest

This commit is contained in:
Tim Wojtulewicz 2024-12-20 15:20:12 -07:00
parent 6bc5f70236
commit 6289eb8e15
3 changed files with 19 additions and 9 deletions

View file

@ -155,6 +155,9 @@ ErrorResult SQLite::DoPut(ValPtr key, ValPtr value, bool overwrite, double expir
return res;
}
if ( expiration_time != 0 )
expiration_time += run_state::network_time;
if ( auto res = checkError(sqlite3_bind_double(stmt, 3, expiration_time)); res.has_value() ) {
sqlite3_reset(stmt);
return res;
@ -244,7 +247,7 @@ ErrorResult SQLite::DoErase(ValPtr key, ErrorResultCallback* cb) {
void SQLite::Expire() {
auto stmt = prepared_stmts["expire"];
if ( auto res = checkError(sqlite3_bind_double(stmt, 1, util::current_time())); res.has_value() ) {
if ( auto res = checkError(sqlite3_bind_double(stmt, 1, run_state::network_time)); res.has_value() ) {
sqlite3_reset(stmt);
// TODO: do something with the error here?
}