What is the problem?
When we calculate the timestamp to check that a log hasn't been created in the last 24 hours, I think the calculation we are doing is incorrect.
It can lead to quite inconsistent results. In some cases we are recording more than one log entry per 24 hour period. It might also be possible that we might see less than 1 log entry per 24 hour period (although I have not seen this yet).
$timestamp = (int)wfTimestampNow() - $this->delay;
(int)wfTimestampNow() returns a MW timestamp YYYYMMDDhhmmss, e.g. 20220304102515.
$this->delay is in seconds, e.g. 86400.
I guess we need to convert (int)wfTimestampNow() to seconds first. Or perhaps we have a MW way of doing this.
Steps to reproduce problem
If you have access to the database query logs:
- Lookup IPInfo for any IP
- Look in the logs and find a line that starts [DBQuery] Wikimedia\Rdbms\Database::selectRowCount
- On that line is a section of the SQL query like (log_timestamp > '20220304015702')
Expected behavior: The timestamp should be exactly 24 hours ago.
Observed behavior: The timestamp isn't exactly 24 hours ago.
Environment
Wiki(s): local docker IP Info 0.0.0 (02f7561) 14:01, 3 March 2022.