mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -05:00
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:
parent
3cd90ae11c
commit
17003f136b
@ -712,25 +712,25 @@ 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;
|
||||
|
||||
#ifdef RS_DATA_SERVICE_DEBUG
|
||||
std::cerr << "RsDataService::storeMessage() ";
|
||||
std::cerr << " GroupId: " << msgMetaPtr->mGroupId.toStdString();
|
||||
std::cerr << " MessageId: " << msgMetaPtr->mMsgId.toStdString();
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "RsDataService::storeMessage() ";
|
||||
std::cerr << " GroupId: " << msgMetaPtr->mGroupId.toStdString();
|
||||
std::cerr << " MessageId: " << msgMetaPtr->mMsgId.toStdString();
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// skip msg item if size if greater than
|
||||
if(!validSize(msgPtr))
|
||||
{
|
||||
std::cerr << "RsDataService::storeMessage() ERROR invalid size";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
{
|
||||
std::cerr << "RsDataService::storeMessage() ERROR invalid size";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
ContentValue cv;
|
||||
|
||||
@ -773,14 +773,18 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
|
||||
cv.put(KEY_CHILD_TS, (int32_t)msgMetaPtr->mChildTs);
|
||||
|
||||
if (!mDb->sqlInsert(MSG_TABLE_NAME, "", cv))
|
||||
{
|
||||
std::cerr << "RsDataService::storeMessage() sqlInsert Failed";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\t For GroupId: " << msgMetaPtr->mGroupId.toStdString();
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\t & MessageId: " << msgMetaPtr->mMsgId.toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
{
|
||||
std::cerr << "RsDataService::storeMessage() sqlInsert Failed";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\t For GroupId: " << msgMetaPtr->mGroupId.toStdString();
|
||||
std::cerr << std::endl;
|
||||
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
|
||||
|
@ -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 )
|
||||
// {
|
||||
|
Loading…
Reference in New Issue
Block a user