Added addDisposableTo(vc?.rx_disposableBag) to the parent ViewController DisposableBag.
The problem is, the accumulated subscriptions and each time you click on the updateWS () call many times, which subscribes to each scroll and never settles.
It is possible that your self.updateOnWS() is called many times because of how you subscribe to a button click.
btn_increase.rx.tap .debounce(1.0, scheduler: MainScheduler.instance) .subscribe(){ event in self.updateOnWS() } .addDisposableTo(rxBag)
As you can see, you are subscribing to all events using the subscribe() method. This means that all Rx events ( onNext , onError , onCompleted , onSubscribed and onDisposed ) fire self.updateOnWS() . You can verify this by printing an event object to find out which event was triggered.
onNext Subscription onNext
A possible solution would only be to subscribe to the onNext operation.
btn_increase.rx.tap .debounce(1.0, scheduler: MainScheduler.instance) .subscribe(onNext: { [weak self] (_ : Void) in self?.updateOnWS() }) .addDisposableTo(vc?.rxdisposableBag)
Using the DisposeBag controller's DisposeBag , you can verify that the operation continues even if the cell is deleted (when you scroll down). However, if you need it to distribute the subscription when the cell is deleted, use the DisposeBag cell, not the view controller.
Side Note - Memory Leak
Please note that the self reference is indicated as weak, so you can prevent a memory leak. Pointing it weak, it will provide you with a link to self, which is optional.
Without this, the closure you created for the onNext block onNext retain a strong reference to self , which is your UICollectionViewCell , which in turn owns the most closed discussion.
This will ultimately lead to a memory failure. See the link that I posted in the comments on your question for more about memory errors caused by the wrong me link.