Fix streamTiming garbage collection infinite loop

This commit is contained in:
Srivats P 2023-04-03 12:47:30 +05:30
parent 68734c44ca
commit c378600baf

View File

@ -37,7 +37,7 @@ StreamTiming::StreamTiming()
gcTimer_ = new QTimer(this); gcTimer_ = new QTimer(this);
connect(gcTimer_, &QTimer::timeout, this, &StreamTiming::deleteStaleRecords); connect(gcTimer_, &QTimer::timeout, this, &StreamTiming::deleteStaleRecords);
gcTimer_->setInterval(30000); gcTimer_->setInterval(30000);
//FIXME:gcTimer_->start(); gcTimer_->start();
} }
bool StreamTiming::recordTxTime(uint portId, uint guid, uint ttagId, bool StreamTiming::recordTxTime(uint portId, uint guid, uint ttagId,
@ -192,11 +192,15 @@ int StreamTiming::deleteStaleRecords()
struct timespec txTime = i.value().timeStamp; struct timespec txTime = i.value().timeStamp;
struct timespec diff; struct timespec diff;
timespecsub(&now, &txTime, &diff); timespecsub(&now, &txTime, &diff);
qDebug("XXXX gc diff %ld", diff.tv_sec);
if (diff.tv_sec > 30) { if (diff.tv_sec > 30) {
i = txHash_.erase(i); i = txHash_.erase(i);
count++; count++;
qDebug("XXXX -%d", count); qDebug("XXXX -%d", count);
} else {
i++;
} }
} }
// FIXME: when to stop gc timer? // FIXME: when to stop gc timer?