modified wrong comment in why mLastPost should not be used in rsgxsnetservice.cc, and added a call to clearing GrpMeta cache when new msg in that group are received

This commit is contained in:
csoler 2016-08-02 16:25:00 +02:00
parent 3cd90ae11c
commit 17003f136b
2 changed files with 27 additions and 20 deletions

View File

@ -712,8 +712,8 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
// start a transaction
mDb->beginTransaction();
for(; mit != msg.end(); ++mit){
for(; mit != msg.end(); ++mit)
{
RsNxsMsg* msgPtr = mit->first;
RsGxsMsgMetaData* msgMetaPtr = mit->second;
@ -781,6 +781,10 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
std::cerr << "\t & MessageId: " << msgMetaPtr->mMsgId.toStdString();
std::cerr << std::endl;
}
// This is needed so that mLastPost is correctly updated in the group meta when it is re-loaded.
locked_clearGrpMetaCache(msgMetaPtr->mGroupId);
}
// finish transaction

View File

@ -2096,7 +2096,10 @@ void RsGxsNetService::updateServerSyncTS()
else
msui = mapIT->second;
// (cyril) I'm removing this, becuse mLastPost is *never* updated. So this code it not useful at all.
// (cyril) I'm removing this, because the msgUpdateTS is updated when new messages are received by calling locked_stampMsgServerUpdateTS().
// mLastPost is actually updated somewhere when loading group meta data. It's not clear yet whether it is set to the latest publish time (wrong)
// or the latest receive time (right). The former would cause problems because it would need to compare times coming from different (potentially async-ed)
// machines.
//
// if(grpMeta->mLastPost > msui->msgUpdateTS )
// {