From 1761282aff97de315fe1f232c780e0a9fb998799 Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Mon, 9 Nov 2020 20:00:15 +0000 Subject: SERVER-52724 Increment TTL passes server status metric after the TTL work has finished --- src/mongo/db/ttl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index d984ea9e9bb..5cdbcd9b80f 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -186,7 +186,8 @@ private: // Pair of collection namespace and index spec. std::vector> ttlIndexes; - ttlPasses.increment(); + // Increment the metric after the TTL work has been finished. + ON_BLOCK_EXIT([&] { ttlPasses.increment(); }); // Get all TTL indexes from every collection. for (const std::pair& ttlInfo : ttlInfos) { -- cgit v1.2.1