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

Make onTimeout use thenError which maintains executor.

Summary: Make onTimeout call thenError which maintains the executor rather than onError which does not.

Reviewed By: yfeldblum

Differential Revision: D8051906

fbshipit-source-id: 41ca5f657a441ff8eaacdfab6d4cfb45d5e5f0c2
parent 69f86ccc
......@@ -1067,8 +1067,8 @@ Future<T> Future<T>::ensure(F&& func) {
template <class T>
template <class F>
Future<T> Future<T>::onTimeout(Duration dur, F&& func, Timekeeper* tk) {
return within(dur, tk).onError(
[funcw = std::forward<F>(func)](FutureTimeout const&) mutable {
return within(dur, tk).template thenError<FutureTimeout>(
[funcw = std::forward<F>(func)](auto const&) mutable {
return std::forward<F>(funcw)();
});
}
......
......@@ -946,7 +946,7 @@ TEST(SemiFuture, onError) {
{
auto f = makeSemiFuture()
.defer([] { return 42; })
.deferError<eggs_t>([&](eggs_t& /* e */) {
.deferError<eggs_t>([&](auto& /* e */) {
flag();
return -1;
});
......
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