From 4624d53dd740d9f950eec3261d6950d6013dd3ef Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 9 May 2015 11:29:31 +0000 Subject: [PATCH] simple hack to have non active groups gradually loose popularity and number of posts. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8225 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/rsgxsnetservice.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 8634ff7b6..3047cf27a 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -854,12 +854,20 @@ bool RsGxsNetService::loadList(std::list &load) for(ClientMsgMap::iterator it = mClientMsgUpdateMap.begin();it!=mClientMsgUpdateMap.end();++it) for(std::map::const_iterator it2(it->second->msgUpdateInfos.begin());it2!=it->second->msgUpdateInfos.end();++it2) - { - RsGroupNetworkStatsRecord& gnsr = mGroupNetworkStats[it2->first] ; + { + RsGroupNetworkStatsRecord& gnsr = mGroupNetworkStats[it2->first] ; - gnsr.suppliers.insert(it->first) ; - gnsr.max_visible_count = std::max(it2->second.message_count,gnsr.max_visible_count) ; - } + // At each reload, divide the last count by 2. This gradually flushes old information away. + + gnsr.max_visible_count = std::max(it2->second.message_count,gnsr.max_visible_count/2) ; + + // Similarly, we remove some of the suppliers randomly. If they are + // actual suppliers, they will come back automatically. If they are + // not, they will be forgotten. + + if(RSRandom::random_f32() > 0.2) + gnsr.suppliers.insert(it->first) ; + } return true; }