konmik / nucleus

Nucleus is an Android library, which utilizes the Model-View-Presenter pattern to properly connect background tasks with visual parts of an application.
MIT License
1.97k stars 253 forks source link

reuse restartable #115

Closed Suhinin closed 8 years ago

Suhinin commented 8 years ago

Hi! How can I reuse restartable with safe previous callbacks? If I'm restart restartable when onNext or onError not going yet (post response with timeout), after restart they will not be happen never.

Solved problem by replace my restartableFirst(...) and start(restartableFirstId) by (pseudocode) : add(MyObserable.compose(deliverFirst).subscribe(split(onNext, onError))) and calling this line every time when I want.

It is correct decision? I must remove subscription from subscriptions list after it complete?

konmik commented 8 years ago

Hi, I do not quite get what is your problem. Observable gets recreated every time you call start, so it should propagate onError as usual.

Suhinin commented 8 years ago

I tried to send some message using your library. So I don't want to recreate observable every time when call start method, because answer from previous call may not be obtained yet (e.g. slow internet connection)

konmik commented 8 years ago

Without recreating restartable observables you will not be able to change their arguments.