Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/cluster/search/PhabricatorMySQLSearchHost.php
Show All 18 Lines | return array( | ||||
pht('Roles') => implode(', ', array_keys($this->getRoles())), | pht('Roles') => implode(', ', array_keys($this->getRoles())), | ||||
); | ); | ||||
} | } | ||||
public function getProtocol() { | public function getProtocol() { | ||||
return 'mysql'; | return 'mysql'; | ||||
} | } | ||||
public function getHealthRecord() { | |||||
if (!$this->healthRecord) { | |||||
$ref = PhabricatorDatabaseRef::getMasterDatabaseRefForApplication( | |||||
'search'); | |||||
$this->healthRecord = $ref->getHealthRecord(); | |||||
} | |||||
return $this->healthRecord; | |||||
} | |||||
epriestley: Maybe split this into `public function getHealthRecord()` (to do the caching) and `protected… | |||||
public function getConnectionStatus() { | public function getConnectionStatus() { | ||||
PhabricatorDatabaseRef::queryAll(); | PhabricatorDatabaseRef::queryAll(); | ||||
$ref = PhabricatorDatabaseRef::getMasterDatabaseRefForApplication('search'); | $ref = PhabricatorDatabaseRef::getMasterDatabaseRefForApplication('search'); | ||||
$status = $ref->getConnectionStatus(); | $status = $ref->getConnectionStatus(); | ||||
return $status; | return $status; | ||||
} | } | ||||
} | } |
Maybe split this into public function getHealthRecord() (to do the caching) and protected function newHealthRecord() (to create a new object if the cache is empty). Then we wouldn't be duplicating the caching in the subclass, and the property could become private.