Skip to content

Commit

Permalink
Merge pull request #8 from Scit/master
Browse files Browse the repository at this point in the history
Fix Api-subscriber's onCompleted call before realm data is loaded
  • Loading branch information
FabianTerhorst authored Aug 5, 2016
2 parents 94298d9 + 9837954 commit be60099
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public <Item extends RealmObject> Observable<List<Item>> getApiObservable(Observ
.compose(applySchedulers())
.compose(getLifecycle());
return Observable.<List<Item>>create(subscriber -> {
realmObserver.subscribe(subscriber::onNext, subscriber::onError);
retrofitObserver.subscribe(this::setItems, subscriber::onError, subscriber::onCompleted);
realmObserver.take(2).subscribe(subscriber::onNext, subscriber::onError, subscriber::onCompleted);
retrofitObserver.subscribe(this::setItems, subscriber::onError);
}).compose(getLifecycle());
} else
return api;
Expand Down

0 comments on commit be60099

Please sign in to comment.