Fixed buffered messages from ages ago getting sent

This commit is contained in:
Jordan Sherer 2018-09-11 17:41:21 -04:00
parent 9f25842c79
commit e699d2e081
2 changed files with 18 additions and 1 deletions

View File

@ -9251,6 +9251,23 @@ void MainWindow::processBufferedActivity() {
foreach(auto freq, m_messageBuffer.keys()) {
auto buffer = m_messageBuffer[freq];
// check to make sure we empty old buffers by getting the latest timestamp
// and checking to see if it's older than one minute.
auto dt = QDateTime::currentDateTimeUtc().addDays(-1);
if(buffer.cmd.utcTimestamp.isValid()){
dt = qMax(dt, buffer.cmd.utcTimestamp);
}
if(!buffer.compound.isEmpty()){
dt = qMax(dt, buffer.compound.last().utcTimestamp);
}
if(!buffer.msgs.isEmpty()){
dt = qMax(dt, buffer.msgs.last().utcTimestamp);
}
if(dt.secsTo(QDateTime::currentDateTimeUtc()) > 60){
m_messageBuffer.remove(freq);
continue;
}
if (buffer.msgs.isEmpty()) {
continue;
}

View File

@ -711,8 +711,8 @@ private:
};
struct MessageBuffer {
QQueue<CallDetail> compound;
CommandDetail cmd;
QQueue<CallDetail> compound;
QList<ActivityDetail> msgs;
};