From: Steinar H. Gunderson Date: Sat, 18 Feb 2012 13:53:20 +0000 (+0100) Subject: Make backgrounded invalidated screens less database-noisy. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=6bd21f38c6a860ba75ea98f2404c83d9bd55498a Make backgrounded invalidated screens less database-noisy. --- diff --git a/bigscreen/groupscreen.cpp b/bigscreen/groupscreen.cpp index 6b2ad3d..88fce1c 100644 --- a/bigscreen/groupscreen.cpp +++ b/bigscreen/groupscreen.cpp @@ -27,13 +27,12 @@ bool GroupScreen::check_invalidated() return true; if (!scores_changed.get_flag()) return false; + scores_changed.reset_flag(); bool needs_update; conn.perform(FetchNeedsUpdate(last_updated, tournament, round, parallel, &needs_update)); - if (!needs_update) - scores_changed.reset_flag(); - + valid = !needs_update; return needs_update; } diff --git a/bigscreen/top10scorescreen.cpp b/bigscreen/top10scorescreen.cpp index f756447..672a906 100644 --- a/bigscreen/top10scorescreen.cpp +++ b/bigscreen/top10scorescreen.cpp @@ -26,6 +26,7 @@ bool Top10ScoreScreen::check_invalidated() return true; if (!scores_changed.get_flag()) return false; + scores_changed.reset_flag(); // check that there are indeed changes, otherwise don't bother std::vector scores; @@ -33,10 +34,11 @@ bool Top10ScoreScreen::check_invalidated() for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { if (seen_topscore.count(*i) == 0) { + valid = false; return true; } } - + return false; } diff --git a/bigscreen/top5chosenscreen.cpp b/bigscreen/top5chosenscreen.cpp index 13cc0b9..702b24f 100644 --- a/bigscreen/top5chosenscreen.cpp +++ b/bigscreen/top5chosenscreen.cpp @@ -25,6 +25,7 @@ bool Top5ChosenScreen::check_invalidated() return true; if (!scores_changed.get_flag()) return false; + scores_changed.reset_flag(); // check that there are indeed changes, otherwise don't bother std::vector scores; @@ -32,6 +33,7 @@ bool Top5ChosenScreen::check_invalidated() for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { if (seen_topchosen.count(*i) == 0) { + valid = false; return true; } }