[ntcore] Reduce limit on flush and update rate to 5 ms

This commit is contained in:
Peter Johnson
2020-12-12 20:16:59 -08:00
parent 20fbb5c63b
commit d85a6d8fe4

View File

@@ -203,9 +203,9 @@ void DispatcherBase::Stop() {
}
void DispatcherBase::SetUpdateRate(double interval) {
// don't allow update rates faster than 10 ms or slower than 1 second
if (interval < 0.01)
interval = 0.01;
// don't allow update rates faster than 5 ms or slower than 1 second
if (interval < 0.005)
interval = 0.005;
else if (interval > 1.0)
interval = 1.0;
m_update_rate = static_cast<unsigned int>(interval * 1000);
@@ -220,8 +220,8 @@ void DispatcherBase::Flush() {
auto now = std::chrono::steady_clock::now();
{
std::scoped_lock lock(m_flush_mutex);
// don't allow flushes more often than every 10 ms
if ((now - m_last_flush) < std::chrono::milliseconds(10)) return;
// don't allow flushes more often than every 5 ms
if ((now - m_last_flush) < std::chrono::milliseconds(5)) return;
m_last_flush = now;
m_do_flush = true;
}