https://kotlinlang.org logo
#rx
Title
# rx
u

ursus

03/21/2020, 3:26 PM
Can I persist/restore Observable from disc?
z

Zach Klippenstein (he/him) [MOD]

03/21/2020, 5:15 PM
Nope. In general, can’t save callbacks to disk, they’re essentially pointers to objects.
u

ursus

03/22/2020, 1:28 AM
Yea wishful thinking, this is going to be painful
z

Zach Klippenstein (he/him) [MOD]

03/22/2020, 4:27 PM
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

ursus

03/22/2020, 9:45 PM
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

Zach Klippenstein (he/him) [MOD]

03/23/2020, 6:34 AM
You can’t just fetch new data when your app starts?
u

ursus

03/24/2020, 7:30 AM
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
2 Views