Dynamic delay value with repeatWhen()

后端 未结 5 1755

Right now I\'m implementing some polling logic with RxJava. I\'m supposed to poll an endpoint a number of times until it tells me to stop. Additionally, each response come

5条回答
  •  孤城傲影
    2020-12-19 03:46

    service.endpoint()
     .flatMap((Function, SingleSource>) response -> Single.just(response).delaySubscription(getDelayFromResponce(response), TimeUnit.MILLISECONDS))
                .repeat()
                .subscribe();
    

提交回复
热议问题