summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorAndrew Witten <andrew.witten@mongodb.com>2022-09-14 17:31:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-14 20:24:46 +0000
commitdd9d37fa07a7af46ac4ee8dabeb235dc9571afb0 (patch)
tree68eb0de4637e3938685caeb45c8a1e9e17065845 /src/mongo/db
parent0d84f4bab0945559abcd5b00be5ec322c5214642 (diff)
downloadmongo-dd9d37fa07a7af46ac4ee8dabeb235dc9571afb0.tar.gz
SERVER-69693 use lambda instead of repeating code
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_commit_monitor.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_commit_monitor.cpp b/src/mongo/db/s/resharding/resharding_coordinator_commit_monitor.cpp
index 2bebf14d448..963ec6a7c54 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_commit_monitor.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_commit_monitor.cpp
@@ -222,10 +222,11 @@ ExecutorFuture<void> CoordinatorCommitMonitor::_makeFuture() const {
.then([this, anchor = shared_from_this()](RemainingOperationTimes remainingTimes) {
// If remainingTimes.max (or remainingTimes.min) is Milliseconds::max, then use -1 so
// that the scale of the y-axis is still useful when looking at FTDC metrics.
- _metrics->setCoordinatorHighEstimateRemainingTimeMillis(
- remainingTimes.max == Milliseconds::max() ? Milliseconds(-1) : remainingTimes.max);
- _metrics->setCoordinatorLowEstimateRemainingTimeMillis(
- remainingTimes.min == Milliseconds::max() ? Milliseconds(-1) : remainingTimes.min);
+ auto clampIfMax = [](Milliseconds t) {
+ return t != Milliseconds::max() ? t : Milliseconds(-1);
+ };
+ _metrics->setCoordinatorHighEstimateRemainingTimeMillis(clampIfMax(remainingTimes.max));
+ _metrics->setCoordinatorLowEstimateRemainingTimeMillis(clampIfMax(remainingTimes.min));
// Check if all recipient shards are within the commit threshold.
if (remainingTimes.max <= _threshold)