From 4a11ac41967b2bbe4e5503c916120f962bf79f46 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Wed, 22 Feb 2023 04:09:35 +0100 Subject: [PATCH] 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`. --- main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 0fcebc0..49da151 100644 --- a/main.cpp +++ b/main.cpp @@ -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;