We can close out if Iām wrong, but when I implemented the new getContextKeys SQL, I used a test for expiration based on the designated time being less than the expiration in the record, i.e. it considers the record expired if they match.
I think the queries going the other way may be off by 1 and treating equality as valid, so want to review.
Environment
None
Activity
Scott CantorAugust 23, 2023 at 12:28 PM
I believe so, when comparing things with the expiration time on the LHS.
expires <= now ā expired
now < expires ā valid
Rod WiddowsonAugust 23, 2023 at 10:52 AM
It seems like these are the problematic statements
"DELETE FROM StorageRecords WHERE expires < ? ";
"DELETE FROM StorageRecords WHERE context = ? AND expires < ?";
"UPDATE StorageRecords SET expires=? WHERE context = ? AND expires > ?";
"SELECT id FROM StorageRecords WHERE context=? AND (expires IS NULL OR expires > ?)";
"SELECT id FROM StorageRecords WHERE context=? AND id like ? AND (expires IS NULL OR expires > ?)";
Iām guessing that we need to systematically change expires < ? to expires <= ?
(it looks like <= is the correct syntax for less than or equal).
We can close out if Iām wrong, but when I implemented the new getContextKeys SQL, I used a test for expiration based on the designated time being less than the expiration in the record, i.e. it considers the record expired if they match.
I think the queries going the other way may be off by 1 and treating equality as valid, so want to review.