mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added auto-consistency between store/sync periods
This commit is contained in:
parent
dd2a3c26de
commit
5953e563f4
@ -629,7 +629,13 @@ void RsGxsNetService::syncWithPeers()
|
||||
msg->PeerId(peerId);
|
||||
msg->updateTS = updateTS;
|
||||
|
||||
int req_delay = (int)mServerGrpConfigMap[grpId].msg_req_delay ;
|
||||
int req_delay = (int)mServerGrpConfigMap[grpId].msg_req_delay ;
|
||||
int keep_delay = (int)mServerGrpConfigMap[grpId].msg_keep_delay ;
|
||||
|
||||
// If we store for less than we request, we request less, otherwise the posts will be deleted after being obtained.
|
||||
|
||||
if(keep_delay > 0 && req_delay > 0 && keep_delay < req_delay)
|
||||
req_delay = keep_delay ;
|
||||
|
||||
// The last post will be set to TS 0 if the req delay is 0, which means "Indefinitly"
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
static const uint32_t MAX_GXS_IDS_REQUESTS_NET = 10 ; // max number of requests from cache/net (avoids killing the system!)
|
||||
|
||||
#define DEBUG_GXSUTIL 1
|
||||
//#define DEBUG_GXSUTIL 1
|
||||
|
||||
#define GXSUTIL_DEBUG() std::cerr << time(NULL) << " : GXS_UTIL : " << __FUNCTION__ << " : "
|
||||
|
||||
@ -50,7 +50,6 @@ RsGxsMessageCleanUp::RsGxsMessageCleanUp(RsGeneralDataService* const dataService
|
||||
mGrpMeta.push_back(cit->second);
|
||||
}
|
||||
|
||||
|
||||
bool RsGxsMessageCleanUp::clean()
|
||||
{
|
||||
uint32_t i = 1;
|
||||
|
@ -353,6 +353,20 @@ void GxsGroupFrameDialog::setStorePostsDelay()
|
||||
std::cerr << "Data is " << duration << std::endl;
|
||||
|
||||
mInterface->setStoragePeriod(mGroupId,duration * 86400) ;
|
||||
|
||||
// If the sync is larger, we reduce it. No need to sync more than we store. The machinery below also takes care of this.
|
||||
//
|
||||
uint32_t sync_period = mInterface->getSyncPeriod(mGroupId);
|
||||
|
||||
if(duration > 0) // the >0 test is to discard the indefinitly test. Basically, if we store for less than indefinitly, the sync is reduced accordingly.
|
||||
{
|
||||
if(sync_period == 0 || sync_period > duration*86400)
|
||||
{
|
||||
mInterface->setSyncPeriod(mGroupId,duration * 86400) ;
|
||||
|
||||
std::cerr << "(II) auto adjusting sync period to " << duration<< " days as well." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -371,6 +385,21 @@ void GxsGroupFrameDialog::setSyncPostsDelay()
|
||||
std::cerr << "Data is " << duration << std::endl;
|
||||
|
||||
mInterface->setSyncPeriod(mGroupId,duration * 86400) ;
|
||||
|
||||
// If the store is smaller, we increase it accordingly. No need to sync more than we store. The machinery below also takes care of this.
|
||||
//
|
||||
uint32_t store_period = mInterface->getStoragePeriod(mGroupId);
|
||||
|
||||
if(duration == 0)
|
||||
mInterface->setStoragePeriod(mGroupId,duration * 86400) ; // indefinite sync => indefinite storage
|
||||
else
|
||||
{
|
||||
if(store_period != 0 && store_period < duration*86400)
|
||||
{
|
||||
mInterface->setStoragePeriod(mGroupId,duration * 86400) ; // indefinite sync => indefinite storage
|
||||
std::cerr << "(II) auto adjusting storage period to " << duration<< " days as well." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::restoreGroupKeys(void)
|
||||
|
Loading…
Reference in New Issue
Block a user