1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

When dirtying repository cluster routing caches after an Almanac edit, discover linked bindings from devices

Summary:
See PHI1030. When you edit an Almanac object, we attempt to discover all the related objects so we can dirty the repository cluster routing cache: if you modify a Device or Service that's part of a clustered repository, we need to blow away our cached view of the layout.

Currently, we don't correctly find linked Bindings when editing a Device, so we may miss Services which have keys that need to be disabled. Instead, discover these linked objects.

See D17000 for the original implementation and more context.

Test Plan:
  - Used `var_dump()` to dump out the discovered objects and dirtied cache keys.
  - Before change: editing a Service dirties repository routing keys (this is correct), but editing a Device does not.
  - After change: editing a Device now correctly dirties repository routing keys.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20003
This commit is contained in:
epriestley 2019-01-20 20:27:32 -08:00
parent afd2ace0dc
commit 881d79c1ea
2 changed files with 9 additions and 1 deletions

View file

@ -30,6 +30,14 @@ final class AlmanacCacheEngineExtension
foreach ($interfaces as $interface) { foreach ($interfaces as $interface) {
$results[] = $interface; $results[] = $interface;
} }
$bindings = id(new AlmanacBindingQuery())
->setViewer($viewer)
->withDevicePHIDs(mpull($devices, 'getPHID'))
->execute();
foreach ($bindings as $binding) {
$results[] = $binding;
}
} }
foreach ($this->selectObjects($objects, 'AlmanacInterface') as $iface) { foreach ($this->selectObjects($objects, 'AlmanacInterface') as $iface) {

View file

@ -2172,7 +2172,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
$parts = array( $parts = array(
"repo({$repository_phid})", "repo({$repository_phid})",
"serv({$service_phid})", "serv({$service_phid})",
'v3', 'v4',
); );
return implode('.', $parts); return implode('.', $parts);