vertx-unit icon indicating copy to clipboard operation
vertx-unit copied to clipboard

An asynchronous operation called in doOnUnsubscribe after the async.complete() call is terminated

Open lightway82 opened this issue 7 years ago • 0 comments

An asynchronous operation called in doOnUnsubscribe after the async.complete() call is terminated. The problem occurs in the tests, if async.complete () is called, then the asynchronous call in the doOnUnsubscribe is interrupted. This can be seen in these two tests.

 @Test
    public void otherTest1(TestContext context){
        Async async = context.async();

            Single.just(1).doOnUnsubscribe(() -> Single.just("MSG")
                                                       .delay(3, TimeUnit.SECONDS)
                                                       .subscribe(System.out::println))
                .subscribe((i) -> async.complete(), context::fail);

        async.awaitSuccess(5000);
    }

    @Test
    public void otherTest2(TestContext context){
        Async async = context.async();

        Single.just(1).doOnUnsubscribe(() -> Single.just("MSG")
                                                   .delay(3, TimeUnit.SECONDS)
                                                   .subscribe(System.out::println))
              .subscribe((i) -> System.out.println(i), context::fail);

        async.await(5000);
    }

lightway82 avatar Sep 14 '17 09:09 lightway82