added last minute check to avoid re-requesting IDs that have been loaded in cache after they where foundmissing

This commit is contained in:
csoler 2020-07-15 22:07:31 +02:00
parent 94918dc1a3
commit b3ab99bd49
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C

View file

@ -657,6 +657,8 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
// also time_stamp the key that this group represents // also time_stamp the key that this group represents
timeStampKey(RsGxsId(gid),RsIdentityUsage(RsServiceType(serviceType()),RsIdentityUsage::IDENTITY_NEW_FROM_GXS_SYNC)) ; timeStampKey(RsGxsId(gid),RsIdentityUsage(RsServiceType(serviceType()),RsIdentityUsage::IDENTITY_NEW_FROM_GXS_SYNC)) ;
should_subscribe = true; should_subscribe = true;
std::cerr << "Received new identity " << gid << " and subscribing to it" << std::endl;
} }
break; break;
@ -2954,9 +2956,19 @@ void p3IdService::requestIdsFromNet()
for(cit = mIdsNotPresent.begin(); cit != mIdsNotPresent.end();) for(cit = mIdsNotPresent.begin(); cit != mIdsNotPresent.end();)
{ {
#ifdef DEBUG_IDS #ifdef DEBUG_IDS
Dbg2() << __PRETTY_FUNCTION__ << " Processing missing key RsGxsId: " Dbg2() << __PRETTY_FUNCTION__ << " Processing missing key RsGxsId: " << cit->first << std::endl;
<< cit->first << std::endl;
#endif #endif
RsGxsIdCache data;
if(!mKeyCache.fetch(cit->first,data))
{
std::cerr << __PRETTY_FUNCTION__ << ". Dropping request for ID " << cit->first << " at last minute, because it was found in cache"<< std::endl;
auto tmp(cit);
++tmp;
mIdsNotPresent.erase(cit);
cit = tmp;
continue;
}
const RsGxsId& gxsId = cit->first; const RsGxsId& gxsId = cit->first;
const std::list<RsPeerId>& peers = cit->second; const std::list<RsPeerId>& peers = cit->second;
@ -3011,8 +3023,7 @@ void p3IdService::requestIdsFromNet()
{ {
const RsPeerId& peer = cit2->first; const RsPeerId& peer = cit2->first;
std::list<RsGxsGroupId> grpIds; std::list<RsGxsGroupId> grpIds;
for( std::list<RsGxsId>::const_iterator gxs_id_it = cit2->second.begin(); for( std::list<RsGxsId>::const_iterator gxs_id_it = cit2->second.begin(); gxs_id_it != cit2->second.end(); ++gxs_id_it )
gxs_id_it != cit2->second.end(); ++gxs_id_it )
{ {
#ifdef DEBUG_IDS #ifdef DEBUG_IDS
Dbg2() << __PRETTY_FUNCTION__ << " passing RsGxsId: " << *gxs_id_it Dbg2() << __PRETTY_FUNCTION__ << " passing RsGxsId: " << *gxs_id_it