I used share and made it a variable so that multip...
# rx
b
I used share and made it a variable so that multiple subscribers can subscribe one observable and only fire the event when there observers. However, I have a repeatWhen that fires off after a few seconds and the id is not getting updated even if I change it
Copy code
private var id = 1
private val getItem: Observable<Any> =
    service.getItem(id) // a Single
        .toObservable()
        .repeatWhen { completed -> completed.delay(3, TimeUnit.SECONDS) }
        .share()
The answer to this is to use
Copy code
Observable.defer { service.getItem(id).toObservable() }