summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/ttl.cpp3
1 files changed, 2 insertions, 1 deletions
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<std::pair<NamespaceString, BSONObj>> 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<UUID, std::string>& ttlInfo : ttlInfos) {