Merge pull request #2321 from csoler/v0.6-BugFixing_10

[WIP] V0.6 bug fixing 10 - replaces 2318
This commit is contained in:
csoler 2021-02-15 18:17:38 +01:00 committed by GitHub
commit ec7a56d01b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 28 deletions

View File

@ -1049,7 +1049,12 @@ int RsDataService::updateGroupKeys(const RsGxsGroupId& grpId,const RsTlvSecurity
mDb->sqlUpdate(GRP_TABLE_NAME, "grpId='" + grpId.toStdString() + "'", cv); mDb->sqlUpdate(GRP_TABLE_NAME, "grpId='" + grpId.toStdString() + "'", cv);
// finish transaction // finish transaction
return mDb->commitTransaction(); bool res = mDb->commitTransaction();
mGrpMetaDataCache.clear(grpId);
mGrpMetaDataCache.setCacheUpToDate(false); // this is needed because clear() doesn't do it (on purpose)
return res;
} }
bool RsDataService::validSize(RsNxsGrp* grp) const bool RsDataService::validSize(RsNxsGrp* grp) const

View File

@ -96,7 +96,7 @@ p3GxsChannels::p3GxsChannels(
// This is not needed since it just loads all channel data ever 5 mins which takes a lot // This is not needed since it just loads all channel data ever 5 mins which takes a lot
// of useless CPU/memory. // of useless CPU/memory.
// //
// RsTickEvent::schedule_in(CHANNEL_PROCESS, 0); RsTickEvent::schedule_in(CHANNEL_PROCESS, 0);
// //
// Test Data disabled in repo. // Test Data disabled in repo.
// //
@ -320,6 +320,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mChannelGroupId = grpChange->mGroupId; ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED; ev->mChannelEventCode = RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
unprocessedGroups.insert(grpChange->mGroupId);
} }
break; break;
@ -329,6 +331,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mChannelGroupId = grpChange->mGroupId; ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::SYNC_PARAMETERS_UPDATED; ev->mChannelEventCode = RsChannelEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
unprocessedGroups.insert(grpChange->mGroupId);
} }
break; break;
@ -352,6 +356,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mChannelGroupId = grpChange->mGroupId; ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::UPDATED_CHANNEL; ev->mChannelEventCode = RsChannelEventCode::UPDATED_CHANNEL;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
unprocessedGroups.insert(grpChange->mGroupId);
} }
break; break;
@ -386,6 +392,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
else else
RsDbg() << " Not notifying already known channel " << grpChange->mGroupId << std::endl; RsDbg() << " Not notifying already known channel " << grpChange->mGroupId << std::endl;
#endif #endif
unprocessedGroups.insert(grpChange->mGroupId);
} }
break; break;
@ -395,6 +403,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mChannelGroupId = grpChange->mGroupId; ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::DELETED_CHANNEL; ev->mChannelEventCode = RsChannelEventCode::DELETED_CHANNEL;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
unprocessedGroups.insert(grpChange->mGroupId);
} }
break; break;
@ -406,6 +416,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mChannelEventCode = RsChannelEventCode::RECEIVED_PUBLISH_KEY; ev->mChannelEventCode = RsChannelEventCode::RECEIVED_PUBLISH_KEY;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
unprocessedGroups.insert(grpChange->mGroupId);
} }
break; break;
@ -413,7 +425,6 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
RsErr() << " Got a GXS event of type " << grpChange->getType() << " Currently not handled." << std::endl; RsErr() << " Got a GXS event of type " << grpChange->getType() << " Currently not handled." << std::endl;
break; break;
} }
} }
/* shouldn't need to worry about groups - as they need to be subscribed to */ /* shouldn't need to worry about groups - as they need to be subscribed to */
@ -422,11 +433,7 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
std::list<RsGxsGroupId> grps; std::list<RsGxsGroupId> grps;
for(auto& grp_id:unprocessedGroups) for(auto& grp_id:unprocessedGroups)
{
bool enabled = false;
if (autoDownloadEnabled(grp_id, enabled) && enabled) // costly call, that's why it's packed down here.
grps.push_back(grp_id); grps.push_back(grp_id);
}
if(!grps.empty()) if(!grps.empty())
request_SpecificSubscribedGroups(grps); request_SpecificSubscribedGroups(grps);
@ -848,8 +855,8 @@ void p3GxsChannels::request_AllSubscribedGroups()
RsGenExchange::getTokenService()->requestGroupInfo(token, ansType, opts); RsGenExchange::getTokenService()->requestGroupInfo(token, ansType, opts);
GxsTokenQueue::queueRequest(token, GXSCHANNELS_SUBSCRIBED_META); GxsTokenQueue::queueRequest(token, GXSCHANNELS_SUBSCRIBED_META);
#define PERIODIC_ALL_PROCESS 300 // TESTING every 5 minutes. //#define PERIODIC_ALL_PROCESS 300 // This
RsTickEvent::schedule_in(CHANNEL_PROCESS, PERIODIC_ALL_PROCESS); // RsTickEvent::schedule_in(CHANNEL_PROCESS, PERIODIC_ALL_PROCESS);
} }

View File

@ -758,6 +758,7 @@ void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptr<con
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]]; case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]];
case RsChannelEventCode::UPDATED_MESSAGE: case RsChannelEventCode::UPDATED_MESSAGE:
case RsChannelEventCode::RECEIVED_PUBLISH_KEY:
case RsChannelEventCode::SYNC_PARAMETERS_UPDATED: case RsChannelEventCode::SYNC_PARAMETERS_UPDATED:
{ {
if(e->mChannelGroupId == groupId()) if(e->mChannelGroupId == groupId())