google / agera

Reactive Programming for Android
Apache License 2.0
7.2k stars 639 forks source link

[question] Push Event on a high speed frequency, Pull Data will too busy to attend to all #164

Closed sfcecy7i closed 7 years ago

sfcecy7i commented 7 years ago

When the Repository changes very fast, how to get every change? Custom Repository?

        val repo = Repositories.mutableRepository("")
        repo.addUpdatable {
            SystemClock.sleep(10L)
            Log.d("TEST", repo.get())
        }
        thread {
            while (true) {
                SystemClock.sleep(1L)
                repo.accept(System.currentTimeMillis().toString())
            }
        }
ghost commented 7 years ago

The mutable repository drops events by design. Possibly the Reservoir would do what you want, I'll let @maxtroy comment on this too

sfcecy7i commented 7 years ago

https://github.com/google/agera/wiki/Reservoirs-and-parallelism I should have got the answer in this page of the wiki. Certainly I should read the wiki again.