kaushikgopal / RxJava-Android-Samples

Learning RxJava for Android by example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

something strange about RxBus ?

bravekingzhang opened this issue · comments

for example: when there are 2 Observers subscribe the RxBUS, the RxBus will send event 4 times, that means ,you will receiver the event 2 times on each Observer.

even if ,I do this ,It sames does not work ,

.debounce(100, TimeUnit.MILLISECONDS)//事件去重
                //.distinct()
                .distinctUntilChanged()
                .subscribe(new Action1<Object>() {
                    @Override
                    public void call(Object event) {
                        Log.e("Rxbus", "call() called with: " + "event = [" + event + "]");
                        eventLisener.dealRxEvent(event);
                    }
                }));

can you help me ,thanks

sorry ,I make a mistake, the really reason is
BUS 's event num = Observer 's num

I found that , I need unsubscribe some useless Observer.