* The max rate limit penalty is now 20 instead of 5 making the bot
more responsive without making it flood; this seems like a
reasonable value but may need to be further tweaked
* No longer unconditionally add `1' to penalty to decrease the
likelihood of the queue being saturated and never getting further
than popping the first message
#include "ServerQueue.H"
#include "Utils.H"
+int ServerQueue::max_penalty = 20;
+
ServerQueue::ServerQueue(Socket * s, bool d)
: Queue(s,d), penalty(0)
{
penalty--;
}
- while (!serverQueue.empty() && (penalty < 5))
+ while (!serverQueue.empty() && (penalty < max_penalty))
{
ServerQueueItem * sqi = serverQueue.front ();
- penalty += sqi->penalty + sqi->getLine().length()/100 + 1;
+ penalty += sqi->penalty + sqi->getLine().length()/100;
bool res = sendLine(sqi->getLine());
int penalty;
BotMutex queue_mutex;
+ static int max_penalty;
+
public:
ServerQueue(Socket *, bool);
~ServerQueue();