From 092484e255b694b160d614d6b3adc5e9dea6d0b1 Mon Sep 17 00:00:00 2001 From: Lee Howes Date: Thu, 2 Aug 2018 16:51:21 -0700 Subject: [PATCH] Future::then 4/n: Future::then(not-try-task) -> Future::thenValue(task) xplat. Summary: Overall plan to modify Future::then to be r-value qualified and use Future::thenTry or Future::thenValue. The goal is to disambiguate folly::Future and to improve type and lifetime safety of Future and its methods. 4/n: Codemod: * rvalue-future.then(callable with operator()(not-a-try)) to rvalue-future.thenValue(callable with operator()(not-a-try)). * rvalue-future.then(callable with operator()()) to rvalue-future.thenValue(callable with operator()(auto&&)). * rvalue-future.then(callable with operator()(auto)) to rvalue-future.thenValue(callable with operator()(auto)). Applied to xplat. Reviewed By: marshallcline Differential Revision: D9133114 fbshipit-source-id: 30cc4f0480ca04b3abda54af3aafd9fc4dfdf0e0 --- xplat/Sonar/SonarWebSocketImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xplat/Sonar/SonarWebSocketImpl.cpp b/xplat/Sonar/SonarWebSocketImpl.cpp index 021d85744..8c01fd6ce 100644 --- a/xplat/Sonar/SonarWebSocketImpl.cpp +++ b/xplat/Sonar/SonarWebSocketImpl.cpp @@ -102,7 +102,7 @@ void SonarWebSocketImpl::start() { folly::makeFuture() .via(sonarEventBase_->getEventBase()) .delayed(std::chrono::milliseconds(0)) - .then([this]() { startSync(); }); + .thenValue([this](auto&&){ startSync(); }); } void SonarWebSocketImpl::startSync() { @@ -192,7 +192,7 @@ void SonarWebSocketImpl::reconnect() { folly::makeFuture() .via(sonarEventBase_->getEventBase()) .delayed(std::chrono::seconds(reconnectIntervalSeconds)) - .then([this]() { startSync(); }); + .thenValue([this](auto&&){ startSync(); }); } void SonarWebSocketImpl::stop() {