From 3d1e43cf2508a88cfa0fe8981d7552f93500e97d Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 22 Jan 2021 16:51:37 +0100 Subject: [PATCH] fixed bug in updating cache from DB --- libretroshare/src/gxs/rsdataservice.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc index 21b8607c4..1205323ef 100644 --- a/libretroshare/src/gxs/rsdataservice.cc +++ b/libretroshare/src/gxs/rsdataservice.cc @@ -1519,7 +1519,10 @@ int RsDataService::updateGroupMetaData(const GrpLocMetaData& meta) c->moveToFirst(); + // temporarily disable the cache so that we get the value from the DB itself. + mUseCache=false; auto meta = locked_getGrpMeta(*c, 0); + mUseCache=true; if(meta) mGrpMetaDataCache.updateMeta(grpId,meta); @@ -1548,7 +1551,11 @@ int RsDataService::updateMessageMetaData(const MsgLocMetaData& metaData) RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, mMsgMetaColumns, KEY_GRP_ID+ "='" + grpId.toStdString() + "' AND " + KEY_MSG_ID + "='" + msgId.toStdString() + "'", ""); c->moveToFirst(); + + // temporarily disable the cache so that we get the value from the DB itself. + mUseCache=false; auto meta = locked_getMsgMeta(*c, 0); + mUseCache=true; if(meta) mMsgMetaDataCache[grpId].updateMeta(msgId,meta);