Skip to content
Snippets Groups Projects
Commit 89794ac9 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2461081 by Wim Leers: Lock test pages are uncacheable but aren't marked as such

parent b4494afa
No related branches found
No related tags found
No related merge requests found
......@@ -119,6 +119,9 @@ public function requestDestination(Request $request) {
* Try to acquire a named lock and report the outcome.
*/
public function lockAcquire() {
// Don't cache lock-testing pages.
\Drupal::service('page_cache_kill_switch')->trigger();
if ($this->lock->acquire('system_test_lock_acquire')) {
$this->lock->release('system_test_lock_acquire');
return ['#markup' => 'TRUE: Lock successfully acquired in \Drupal\system_test\Controller\SystemTestController::lockAcquire()'];
......@@ -132,6 +135,9 @@ public function lockAcquire() {
* Try to acquire a specific lock, and then exit.
*/
public function lockExit() {
// Don't cache lock-testing pages.
\Drupal::service('page_cache_kill_switch')->trigger();
if ($this->lock->acquire('system_test_lock_exit', 900)) {
echo 'TRUE: Lock successfully acquired in \Drupal\system_test\Controller\SystemTestController::lockExit()';
// The shut-down function should release the lock.
......@@ -152,6 +158,9 @@ public function lockExit() {
* The text to display.
*/
public function lockPersist($lock_name) {
// Don't cache lock-testing pages.
\Drupal::service('page_cache_kill_switch')->trigger();
if ($this->persistentLock->acquire($lock_name)) {
return ['#markup' => 'TRUE: Lock successfully acquired in SystemTestController::lockPersist()'];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment