PacktPublishing / Drupal-9-Module-Development-Third-Edition

Drupal 9 Module Development, published by Packt
69 stars 50 forks source link

LockBackendInterface::wait() needs to be followed by another attempt to acquire the lock #3

Closed bradbulger closed 2 years ago

bradbulger commented 2 years ago

This relates to the locking code from Chapter 14 on.

From the comments in the code: "You still need to acquire the lock manually and it may fail again."

An example use is in PrivateTempStore::set(). You have to follow a return of FALSE from wait() with a second acquire() to actually claim the lock.

nithikpackt commented 2 years ago

Thank you @bradbulger for the solution