Commit 99ad09f9 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Use rvalue overload of Future::then in retrying

Summary:
Overall plan to modify Future<T>::then to be r-value qualified and use Future<T>::thenTry or Future<T>::thenValue.

The goal is to disambiguate folly::Future and to improve type and lifetime safety of Future and its methods.

Reviewed By: yfeldblum

Differential Revision: D9273440

fbshipit-source-id: f1e1b91fd8fe02020a5919b9193644e256413982
parent 9a1abfca
...@@ -84,7 +84,7 @@ void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) { ...@@ -84,7 +84,7 @@ void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) {
using F = invoke_result_t<FF, size_t>; using F = invoke_result_t<FF, size_t>;
using T = typename F::value_type; using T = typename F::value_type;
auto f = makeFutureWith([&] { return ff(k++); }); auto f = makeFutureWith([&] { return ff(k++); });
f.then([k, std::move(f).then([k,
prom = std::move(prom), prom = std::move(prom),
pm = std::forward<Policy>(p), pm = std::forward<Policy>(p),
ffm = std::forward<FF>(ff)](Try<T>&& t) mutable { ffm = std::forward<FF>(ff)](Try<T>&& t) mutable {
...@@ -94,7 +94,7 @@ void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) { ...@@ -94,7 +94,7 @@ void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) {
} }
auto& x = t.exception(); auto& x = t.exception();
auto q = makeFutureWith([&] { return pm(k, x); }); auto q = makeFutureWith([&] { return pm(k, x); });
q.then([k, std::move(q).then([k,
prom = std::move(prom), prom = std::move(prom),
xm = std::move(x), xm = std::move(x),
pm = std::move(pm), pm = std::move(pm),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment