Problem/Motivation
Spotted while working on #2575105: Use cache collector for state.
CacheCollector contains a method to normalize the lock name before calling acquiring the lock:
$lock_name = $this->normalizeLockName($cid . ':' . __CLASS__);
if (!$lock || $this->lock->acquire($lock_name)) {
But this shouldn't be the cache collector's problem, the lock subsystem should deal with that - and it does:
public function acquire($name, $timeout = 30.0) {
$name = $this->normalizeName($name);
It turns out that CacheCollector::normalizeLockName() and DatabaseLockBackend::normalizeName() basically do the same thing. CacheCollector::normalizeLockName() predates #2872276: Database lock backend should normalize the lock name but no followup was created to remove other normalizations.
Steps to reproduce
Proposed resolution
Remove CacheCollector::normalizeLockName().
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3436804
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
longwaveComment #4
longwaveComment #5
longwaveLooked for other instances by searching for
->acquire(and reading the surrounding code, didn't find any.Comment #6
spokjeExplanation makes sense
Code changes make sense
Tests are green
-------------------------+
RTBC
Comment #7
alexpottI think we should deprecate this for removal from 11.x. This is in an abstract class - the whole point it to extend it. I can't find any usages in contrib https://git.drupalcode.org/search?group_id=2&repository_ref=&scope=blobs... but it would not be surprising if someone somewhere calls this method. Can we open a 10.3.x branch that does the deprecation and create a CR?
Comment #8
longwaveAdded deprecation, test, and CR: https://www.drupal.org/node/3436961
Comment #9
spokjeLGTM
Comment #10
alexpottCommitted the removal to 11.x and the deprecation to 10.3.x.
Committed 1f1d1ab and pushed to 11.x. Thanks!
Committed 0445faf and pushed to 10.3.x. Thanks!