Skip to content

Commit 850e7da

Browse files
elelelKirk Shoop
authored andcommitted
Retry operator argument semantics fix (#362)
* Fix retry operator's argument semantics * Rephrase comments in tries parameter desc
1 parent 570d2d4 commit 850e7da

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Rx/v2/src/rxcpp/operators/rx-retry.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
\tparam Count the type of the counter (optional)
1010
11-
\param t the number of retries (optional) If not specified, infinitely retries the source observable. Specifying returns immediately without subscribing
11+
\param t the total number of tries (optional), i.e. retry(2) means one normal try, before an error occurs, and one retry. If not specified, infinitely retries the source observable. Specifying 0 returns immediately without subscribing
1212
1313
\return An observable that mirrors the source observable, resubscribing to it if it calls on_error up to a specified number of retries.
1414
@@ -100,7 +100,6 @@ namespace retry {
100100
struct values {
101101
values(source_type s, count_type t)
102102
: source(std::move(s)), remaining_(std::move(t)) {
103-
if (remaining_ != 0) ++remaining_;
104103
}
105104

106105
inline bool completed_predicate() const {

Rx/v2/test/operators/retry.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ SCENARIO("retry 0, basic test", "[retry][operators]") {
119119

120120

121121
SCENARIO("retry with failure", "[retry][operators]") {
122-
GIVEN("hot observable of 3x4x7 ints with errors inbetween the groups. Retry 1. Must fail.") {
122+
GIVEN("hot observable of 3x4x7 ints with errors inbetween the groups. Retry 2. Must fail.") {
123123
auto sc = rxsc::make_test();
124124
auto w = sc.create_worker();
125125
const rxsc::test::messages<int> on;
@@ -145,12 +145,12 @@ SCENARIO("retry with failure", "[retry][operators]") {
145145
on.completed(725)
146146
});
147147

148-
WHEN("retry of 1 is launched with expected error before complete") {
148+
WHEN("retry of 2 is launched with expected error before complete") {
149149

150150
auto res = w.start(
151151
[&]() {
152152
return xs
153-
.retry(1)
153+
.retry(2)
154154
// forget type to workaround lambda deduction bug on msvc 2013
155155
.as_dynamic();
156156
});

0 commit comments

Comments
 (0)