From 821d40fe745e65eac41cb3e6b6493fe2844b4a10 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 16 May 2018 21:42:05 -0400 Subject: [PATCH] Reinstitutes the cap on maximum updating time. --- Concurrency/BestEffortUpdater.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Concurrency/BestEffortUpdater.cpp b/Concurrency/BestEffortUpdater.cpp index ce8e6041d..3d452a081 100644 --- a/Concurrency/BestEffortUpdater.cpp +++ b/Concurrency/BestEffortUpdater.cpp @@ -39,7 +39,9 @@ void BestEffortUpdater::update() { const int64_t integer_duration = std::chrono::duration_cast(elapsed).count(); if(integer_duration > 0) { if(delegate_) { - const double duration = static_cast(integer_duration) / 1e9; + // Cap running at 1/5th of a second, to avoid doing a huge amount of work after any + // brief system interruption. + const double duration = std::min(static_cast(integer_duration) / 1e9, 0.2); delegate_->update(this, duration, has_skipped_); } has_skipped_ = false;