Add check to stop processor before starting.

This commit is contained in:
Kalila L 2021-03-14 21:50:08 -04:00
parent e12e746698
commit 9d15b00fbb
2 changed files with 5 additions and 1 deletions

View file

@ -132,6 +132,10 @@ void MessagesMixer::processMaxMessagesContainer() {
}
void MessagesMixer::startMaxMessagesProcessor() {
if (_maxMessagesTimer) {
stopMaxMessagesProcessor();
}
_maxMessagesTimer = new QTimer();
connect(_maxMessagesTimer, &QTimer::timeout, this, &MessagesMixer::processMaxMessagesContainer);
_maxMessagesTimer->start(MESSAGES_MIXER_RATE_LIMITER_INTERVAL); // Clear the container every second.

View file

@ -46,7 +46,7 @@ private:
const int DEFAULT_NODE_MESSAGES_PER_SECOND = 1000;
int _maxMessagesPerSecond { 0 };
QTimer* _maxMessagesTimer;
QTimer* _maxMessagesTimer { nullptr };
};
#endif // hifi_MessagesMixer_h