log errors storing persistance

This commit is contained in:
El RIDO 2021-06-16 05:32:45 +02:00
parent 3d9ba10fcb
commit fd08d991fe
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
3 changed files with 11 additions and 4 deletions

View file

@ -73,7 +73,10 @@ class PurgeLimiter extends AbstractPersistence
if ($pl + self::$_limit >= $now) {
return false;
}
self::$_store->setValue((string) $now, 'purge_limiter');
return true;
$hasStored = self::$_store->setValue((string) $now, 'purge_limiter');
if (!$hasStored) {
error_log('failed to store the purge limiter, skipping purge cycle to avoid getting stuck in a purge loop');
}
return $hasStored;
}
}

View file

@ -65,7 +65,9 @@ class ServerSalt extends AbstractPersistence
self::$_salt = $salt;
} else {
self::$_salt = self::generate();
self::$_store->setValue(self::$_salt, 'salt');
if (!self::$_store->setValue(self::$_salt, 'salt')) {
error_log('failed to store the server salt, delete tokens, traffic limiter and user icons won\'t work');
}
}
return self::$_salt;
}

View file

@ -172,7 +172,9 @@ class TrafficLimiter extends AbstractPersistence
$tl = time();
$result = true;
}
self::$_store->setValue((string) $tl, 'traffic_limiter', $hash);
if (!self::$_store->setValue((string) $tl, 'traffic_limiter', $hash)) {
error_log('failed to store the traffic limiter, it probably contains outdated information');
}
return $result;
}
}