New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cache refresh #5562
Fix cache refresh #5562
Conversation
Improvement of FreshRSS#4422 The main problem was due to `touch()` not automatically clearing the file status cache, and requiring a call to `clearstatcache()`. Example: ``` php > touch('/tmp/touch.txt'); php > echo date('c', filemtime('/tmp/touch.txt')); 2023-08-03T17:27:43+02:00 php > touch('/tmp/touch.txt'); php > echo date('c', filemtime('/tmp/touch.txt')); 2023-08-03T17:27:43+02:00 php > clearstatcache(true, '/tmp/touch.txt'); php > echo date('c', filemtime('/tmp/touch.txt')); 2023-08-03T17:28:21+02:00 ```
@@ -385,10 +385,14 @@ public static function actualizeFeed(int $feed_id, string $feed_url, bool $force | |||
} | |||
if ($simplePiePush === null && $feed_id === 0 && (time() <= $feed->lastUpdate() + $ttl)) { | |||
//Too early to refresh from source, but check whether the feed was updated by another user | |||
if ($mtime <= 0 || $feed->lastUpdate() >= $mtime) { | |||
$ε = 10; // negligible offset errors in seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ε = 10; // negligible offset errors in seconds | |
$errorInSeconds = 10; // negligible offset errors in seconds |
it's more explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a fixed error, it is a negligible offset, commonly called epsilon :-)
$ε = 10; // negligible offset errors in seconds | ||
if ($mtime <= 0 || | ||
$feed->lastUpdate() + $ε >= $mtime || | ||
time() + $ε >= $mtime + FreshRSS_Context::$system_conf->limits['cache_duration']) { // is cache still valid? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time() + $ε >= $mtime + FreshRSS_Context::$system_conf->limits['cache_duration']) { // is cache still valid? | |
time() + $errorInSeconds >= $mtime + FreshRSS_Context::$system_conf->limits['cache_duration']) { // is cache still valid? |
Improvement of #4422
The main problem was due to
touch()
not automatically clearing the file status cache, and requiring a call toclearstatcache()
. Example: