Fixed leak when executing UseCase multiple times.#140
Fixed leak when executing UseCase multiple times.#140amatkivskiy wants to merge 1 commit intoandroid10:masterfrom amatkivskiy:patch-1
Conversation
|
@amatkivskiy hi,I think you can describe the reason about leak bug. why you change code like this? how reproduction this leak? thanks! |
|
@chaozaiai Hi, the problem that we are not checking if there was previously subscribed Subscriber. That means that if you trigger usecase second time you will have leaking first Subscriber because |
|
I am sorry but to do unsubscribe is not flexible , maybe you'd better just add some flag like "is Running" and you can check so if it is running then do not execution but if you still want to repeat a request then just call unsubscribe method in a presenter |
|
@Yukooo Thanks for the point. Can you describe the case when it is not flexible? |
|
Here is my version that I use
And in presenter I can check whether a UseCase is being performed (using isRunning()) so as result presenter can check some condition and decide whether it can stop current task or just give it a chance to finish |
|
@amatkivskiy I forgot to say about a configuration changing, so there is case:
|
|
@Yukooo Sorry, for late response, I was on vacation. Regarding first comment: Regarding second comment: |
|
I think this can be closed after latest refactorings and migration to RxJava 2. |
Hi guys,
Here is the pull request that fixes #135 .