Skip to content

Why retry method with predicate only retries 2 times? #2826

Closed
@fatroom

Description

@fatroom

Hi, can somebody explain me why following piece of code printing only two times message "Retrying"? And not 5 times as specified in predicate?
BTW if i uncomment doOnError line in this sample - i got 5 times message "Retrying".
Any ideas what's going on here?

Observable.just(1)
                .map(value -> { throw new RuntimeException("You shall not pass"); })
//                .doOnError(t -> System.out.println("Handling error"))
                .retry((counter, throwable) -> {
                    System.out.println("Retrying");
                    return counter < 5;
                })
                .toBlocking()
                .single();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions