Can I persist/restore Observable from disc?
# rx
u
Can I persist/restore Observable from disc?
z
Nope. In general, can’t save callbacks to disk, they’re essentially pointers to objects.
u
Yea wishful thinking, this is going to be painful
z
It sounds like an odd problem to try to solve. What does your overall architecture look like? What componet(s) are responsible for providing triggers? What causes triggers to be added?
u
If I dumb it down, essential its
Copy code
syncTriggerRelay.flatMap { trigger ->
   Observable.timer(trigger.scheduleIn, .. )
      .flatMap { repo.fetchAndSyncData }
}
use case of this is basically a workaround for api that cannot provide a completion of mutating action, so app just wishfully fetches new data in some time later
so if you kill the app while the timer was pending, youll never get it
z
You can’t just fetch new data when your app starts?
u
Well, that might be too soon, if app is restarted before the timer, prolly not the end of the world to have the timer again, but I need to persists the requests anyways