void DataCache::notifyObservers(const RCSResourceAttributes Att, int eCode)
{
+ bool same = true;
{
std::lock_guard<std::mutex> lock(att_mutex);
- if (attributes == Att)
+ if (attributes != Att)
{
- return;
+ same = false;
+ attributes = Att;
}
- attributes = Att;
}
std::lock_guard<std::mutex> lock(m_mutex);
for (auto &i : * subscriberList)
{
- if (i.second.first.rf == REPORT_FREQUENCY::UPTODATE)
+ if (i.second.first.rf == REPORT_FREQUENCY::WHENEVER_NOTIFIED)
+ {
+ i.second.second(this->sResource, Att, eCode);
+ }
+ else if (i.second.first.rf == REPORT_FREQUENCY::UPTODATE && !same)
{
i.second.second(this->sResource, Att, eCode);
}