sockeqwe / sqlbrite-dao

DAO for SQLBrite
http://hannesdorfmann.com/android/sqlbrite-dao
Apache License 2.0
182 stars 22 forks source link

Defer Observable code until subscription #26

Closed esneider closed 8 years ago

esneider commented 8 years ago

There's no point to using an Observable as the return type for the DAO operations if the Observable code is executed upon Observable creation, instead of subscription.

For an explanation of the reasoning and benefits of this approach, see: http://blog.danlew.net/2015/07/23/deferring-observable-code-until-subscription-in-rxjava/

sockeqwe commented 8 years ago

Thanks! Yes there was an intention by not making them defered, because I had some issue with backpressure which is harder to maintain by using defer.

So I'm not sure about making everything deferred. I mean it make sense in 99 % of the cases for a database. But there is a reason why not every observable is deferred by default in RxJava.

I have to think about that...

What do you think?

esneider commented 8 years ago

Since all these streams will have a single item before being terminated, I don't think there'll be any issue with backpressure.

sockeqwe commented 8 years ago

Merged, thanks!