Occasionally we'd get a false from Profile::getKV

Due to cache miss? Probably, but now we simply say that it's null in that case
so we get a proper exception from Notice::_setProfiles
This commit is contained in:
Mikael Nordfeldth 2014-07-03 11:55:24 +02:00
parent b63f6e949c
commit 1f97376813

View File

@ -150,7 +150,10 @@ class Notice extends Managed_DataObject
public function getProfile()
{
if (!isset($this->_profile[$this->profile_id])) {
$this->_setProfile(Profile::getKV('id', $this->profile_id));
// We could've sent getKV directly to _setProfile, but occasionally we get
// a "false" (instead of null), likely because it indicates a cache miss.
$profile = Profile::getKV('id', $this->profile_id);
$this->_setProfile($profile instanceof Profile ? $profile : null);
}
return $this->_profile[$this->profile_id];
}