kaushikgopal / RxJava-Android-Samples

Learning RxJava for Android by example
Apache License 2.0
7.55k stars 1.37k forks source link

something strange about RxBus ? #74

Closed bravekingzhang closed 8 years ago

bravekingzhang commented 8 years ago

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

bravekingzhang commented 8 years ago

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.