Fix #51: These last days the algorithm seems to not treat completely firstly the starting set of channels before treating discovered channels

I verified that this commit solves the issue by treating only `CHANNELS` tab of the channels in `channels.txt`.
This commit is contained in:
Benjamin Loison 2023-02-22 04:09:35 +01:00
parent c30847c1f5
commit 4a11ac4196

View File

@ -631,7 +631,8 @@ void addChannelToTreat(unsigned short threadId, string channelId)
channelsAlreadyTreatedAndToTreatMutex.lock();
if(channelsAlreadyTreated.find(channelId) == channelsAlreadyTreated.end() && channelsToTreatRev.find(channelId) == channelsToTreatRev.end())
{
unsigned int channelsToTreatIndex = channelsToTreat.end()->first + 1;
// It is unclear to me why `channelsToTreat.end()->first + 1` doesn't work here.
unsigned int channelsToTreatIndex = channelsToTreat.rbegin()->first + 1;
channelsToTreat[channelsToTreatIndex] = channelId;
channelsToTreatRev[channelId] = channelsToTreatIndex;