From: Dan Brown Date: Thu, 17 Aug 2023 20:24:35 +0000 (+0100) Subject: Status: Updated cache check to use unique key X-Git-Tag: v23.08~1^2~12 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/e44ef57219049bd8523b1cbee9bae0ef69fc6f59 Status: Updated cache check to use unique key Updated status endpoint cache check to include a random component in the key to avoid conflict during simultaneous checks. For #4396 --- diff --git a/app/Settings/StatusController.php b/app/Settings/StatusController.php index 5193bc50d..e4321bf30 100644 --- a/app/Settings/StatusController.php +++ b/app/Settings/StatusController.php @@ -20,10 +20,11 @@ class StatusController extends Controller return DB::table('migrations')->count() > 0; }), 'cache' => $this->trueWithoutError(function () { - $rand = Str::random(); - Cache::add('status_test', $rand); + $rand = Str::random(12); + $key = "status_test_{$rand}"; + Cache::add($key, $rand); - return Cache::pull('status_test') === $rand; + return Cache::pull($key) === $rand; }), 'session' => $this->trueWithoutError(function () { $rand = Str::random();