]> git.sesse.net Git - ccbs/commitdiff
Make backgrounded invalidated screens less database-noisy.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 18 Feb 2012 13:53:20 +0000 (14:53 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 18 Feb 2012 13:53:20 +0000 (14:53 +0100)
bigscreen/groupscreen.cpp
bigscreen/top10scorescreen.cpp
bigscreen/top5chosenscreen.cpp

index 6b2ad3d5ae6ff83778710ea1df6aaf08b0a1dc96..88fce1cc03606f527cce3c12158cd641c2956466 100644 (file)
@@ -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;
 }
 
index f756447243dee4f49f69a9992726a81ea6770d07..672a906d9fd5261e011f58ec60beb8384c208304 100644 (file)
@@ -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<TopScore> scores;
@@ -33,10 +34,11 @@ bool Top10ScoreScreen::check_invalidated()
        
        for (std::vector<TopScore>::const_iterator i = scores.begin(); i != scores.end(); ++i) {
                if (seen_topscore.count(*i) == 0) {
+                       valid = false;
                        return true;
                }
        }
-       
+
        return false;
 }
 
index 13cc0b911aeb69029fb816b9642b6fb98ee3ff72..702b24fdab551d5e2e8665abfde40c65b8b1f0d4 100644 (file)
@@ -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<TopChosen> scores;
@@ -32,6 +33,7 @@ bool Top5ChosenScreen::check_invalidated()
 
        for (std::vector<TopChosen>::const_iterator i = scores.begin(); i != scores.end(); ++i) {
                if (seen_topchosen.count(*i) == 0) {
+                       valid = false;
                        return true;
                }       
        }