diff options
-rw-r--r-- | src/mongo/db/repl/primary_only_service.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/repl/primary_only_service.h | 8 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/mongo/db/repl/primary_only_service.cpp b/src/mongo/db/repl/primary_only_service.cpp index 1dd6d6ebd6d..87573eea45d 100644 --- a/src/mongo/db/repl/primary_only_service.cpp +++ b/src/mongo/db/repl/primary_only_service.cpp @@ -761,7 +761,7 @@ void PrimaryOnlyService::_rebuildInstances(long long term) { std::shared_ptr<PrimaryOnlyService::Instance> PrimaryOnlyService::_insertNewInstance( WithLock wl, std::shared_ptr<Instance> instance, InstanceID instanceID) { CancellationSource instanceSource(_source.token()); - auto instanceCompleteFuture = + auto runCompleteFuture = ExecutorFuture<void>(**_scopedExecutor) .then([serviceName = getServiceName(), instance, @@ -780,10 +780,8 @@ std::shared_ptr<PrimaryOnlyService::Instance> PrimaryOnlyService::_insertNewInst }) .semi(); - auto [it, inserted] = _activeInstances.try_emplace(instanceID, - std::move(instance), - std::move(instanceSource), - std::move(instanceCompleteFuture)); + auto [it, inserted] = _activeInstances.try_emplace( + instanceID, std::move(instance), std::move(instanceSource), std::move(runCompleteFuture)); invariant(inserted); return it->second.getInstance(); } diff --git a/src/mongo/db/repl/primary_only_service.h b/src/mongo/db/repl/primary_only_service.h index ed78f65afc6..5c53eaa4303 100644 --- a/src/mongo/db/repl/primary_only_service.h +++ b/src/mongo/db/repl/primary_only_service.h @@ -366,9 +366,9 @@ private: public: ActiveInstance(std::shared_ptr<Instance> instance, CancellationSource source, - SemiFuture<void> instanceComplete) + SemiFuture<void> runCompleteFuture) : _instance(std::move(instance)), - _instanceComplete(std::move(instanceComplete)), + _runCompleteFuture(std::move(runCompleteFuture)), _source(std::move(source)) { invariant(_instance); } @@ -383,7 +383,7 @@ private: * Blocking call that returns once the instance has finished running. */ void waitForCompletion() const { - _instanceComplete.wait(); + _runCompleteFuture.wait(); } std::shared_ptr<Instance> getInstance() const { @@ -399,7 +399,7 @@ private: const std::shared_ptr<Instance> _instance; // A future that will be resolved when the passed in Instance has finished running. - const SemiFuture<void> _instanceComplete; + const SemiFuture<void> _runCompleteFuture; // Each instance of a PrimaryOnlyService will own a CancellationSource for memory management // purposes. Any memory associated with an instance's CancellationSource will be cleaned up |