]> BookStack Code Mirror - bookstack/commitdiff
Status: Updated cache check to use unique key
authorDan Brown <redacted>
Thu, 17 Aug 2023 20:24:35 +0000 (21:24 +0100)
committerDan Brown <redacted>
Thu, 17 Aug 2023 20:24:35 +0000 (21:24 +0100)
Updated status endpoint cache check to include a random component in the
key to avoid conflict during simultaneous checks.
For #4396

app/Settings/StatusController.php

index 5193bc50d027f1d2ddb68f91de0e89fe53a4b07e..e4321bf30dba59e2ada9a2973f5a99d0e86aae0e 100644 (file)
@@ -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();