Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.

Commit 0d52496

Browse files
committed
Trigger initial query with less overhead.
Rather than a bunch of allocations to create and concat two streams (which startWith does) just move the initial emission to our custom observable.
1 parent 3572936 commit 0d52496

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

sqlbrite/src/main/java/com/squareup/sqlbrite/BriteContentResolver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ public QueryObservable createQuery(@NonNull final Uri uri, @Nullable final Strin
117117
contentResolver.unregisterContentObserver(observer);
118118
}
119119
}));
120+
121+
subscriber.onNext(query); // Trigger initial query.
120122
}
121123
};
122124
Observable<Query> queryObservable = Observable.create(subscribe) //
123125
.onBackpressureLatest() // Guard against uncontrollable frequency of upstream emissions.
124-
.startWith(query) //
125126
.observeOn(scheduler) //
126127
.onBackpressureLatest(); // Guard against uncontrollable frequency of scheduler executions.
127128
return new QueryObservable(queryObservable);

0 commit comments

Comments
 (0)