]> git.hungrycats.org Git - bees/commitdiff
roots: move the transid cache update into transid_max_nocache()
authorZygo Blaxell <bees@furryterror.org>
Sat, 14 Dec 2024 04:04:28 +0000 (23:04 -0500)
committerZygo Blaxell <bees@furryterror.org>
Sat, 14 Dec 2024 04:19:43 +0000 (23:19 -0500)
All callers of the `transid_max_nocache` method update `m_transid_re`
with the return value, so do that in `transid_max_nocache` itself.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-roots.cc

index d913fa11d915293b1f20abbebb8d8abe10a3da7c..991abd3f7466055daf7093bf9f83bbf66f943315 100644 (file)
@@ -1280,6 +1280,9 @@ BeesRoots::transid_max_nocache()
        THROW_CHECK1(runtime_error, rv, rv > 0);
        // transid must be less than max, or we did something very wrong
        THROW_CHECK1(runtime_error, rv, rv < numeric_limits<uint64_t>::max());
+
+       // Update the rate estimator
+       m_transid_re.update(rv);
        return rv;
 }
 
@@ -1497,7 +1500,8 @@ BeesRoots::crawl_thread()
                BEESTRACE("Measure current transid");
                catch_all([&]() {
                        BEESTRACE("calling transid_max_nocache");
-                       m_transid_re.update(transid_max_nocache());
+                       // Will update m_transid_re as side effect
+                       transid_max_nocache();
                });
 
                const auto new_transid = m_transid_re.count();
@@ -1682,7 +1686,7 @@ BeesRoots::start()
        m_crawl_thread.exec([&]() {
                // Measure current transid before creating any crawlers
                catch_all([&]() {
-                       m_transid_re.update(transid_max_nocache());
+                       transid_max_nocache();
                });
 
                // Make sure we have a full complement of crawlers