The problem that Crell ran into in trying to address request scope dependency issues in #1874500: CMF-based Routing system is one that I mistakenly ignored when working on #1269742: Make path lookup code into a pluggable class - which means the code in there is faulty :-(
public function writeCache() {
$path_lookups = $this->getPathLookups();
// Check if the system paths for this page were loaded from cache in this
// request to avoid writing to cache on every request.
if ($this->cacheNeedsWriting && !empty($path_lookups) && !empty($this->cacheKeys)) {
// Use the system path of the current request for the cache ID (cid).
$cid = end($this->cacheKeys);
// Set the path cache to expire in 24 hours.
$expire = REQUEST_TIME + (60 * 60 * 24);
$this->cache->set($cid, $path_lookups, $expire);
}
// We are at the end of the request, so pop off the last request path.
array_pop($this->cacheKeys);
}
That last comment is completely delusional - this gets called when the kernel terminates, *not* at the end of a request. There is currently no way to make sure this gets called at the end of each (sub)request. But apparently fabpot is working on a solution: https://github.com/symfony/symfony/issues/5300
In the meantime we should try and come up with something that is at least less utterly false.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1891692.fix-system-path-caching.patch | 3.05 KB | katbailey |
Comments
Comment #1
katbailey CreditAttribution: katbailey commentedChatted with Crell and catch about this and the consensus is that we only want the writeCache() method to run for the master request - will roll a patch tonight.
Comment #2
katbailey CreditAttribution: katbailey commentedComment #3
Crell CreditAttribution: Crell commentedAssuming the bot approves, this is nice and straightforward. It would be good to get in before we merge the alias logic in with the generator in #1888424: Make Drupal's URL generation logic available to HttpKernel, and minimize code repetition/divergence
Comment #4
webchickCommitted and pushed to 8.x. Thanks!