Commit 1d3ee8c5 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Fix for lifetime bug in retrying.

Summary: Late change in D9175807 removed necessary temporaries. This caused a lifetime management problem for GCC.

Reviewed By: Orvid

Differential Revision: D9227937

fbshipit-source-id: d5fea8a98855c6302189a7dee8cd5862d13a63a3
parent 7ef79a5f
...@@ -83,8 +83,8 @@ template <class Policy, class FF, class Prom> ...@@ -83,8 +83,8 @@ template <class Policy, class FF, class Prom>
void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) { 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;
makeFutureWith([&] { return ff(k++); }) auto f = makeFutureWith([&] { return ff(k++); });
.then([k, 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 {
...@@ -93,8 +93,8 @@ void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) { ...@@ -93,8 +93,8 @@ void retryingImpl(size_t k, Policy&& p, FF&& ff, Prom prom) {
return; return;
} }
auto& x = t.exception(); auto& x = t.exception();
makeFutureWith([&] { return pm(k, x); }) auto q = makeFutureWith([&] { return pm(k, x); });
.then([k, 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