Skip to content

Commit

Permalink
Merge pull request #13 from Wolox/fix-repository-cache
Browse files Browse the repository at this point in the history
Fix fetch data on cache miss in Repository.java
  • Loading branch information
Fabian Alvarez authored Dec 22, 2017
2 parents f504be3 + ccb6365 commit 1923610
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ public void run() {
T cachedData = queryStrategy.readLocalSource(mCache);
if (cachedData != null) {
doOnSuccess(cachedData);
} else if (policy == CACHE_ONLY) {
doOnError(new CacheMissException());
} else {
if (policy == CACHE_ONLY) {
doOnError(new CacheMissException());
} else {
fetchData(call, queryStrategy, this);
}
}
}
};
Expand Down Expand Up @@ -181,7 +185,7 @@ public void query(@AccessPolicy final int policy, @NonNull final Call<T> call,
*/
public void query(@NonNull final Call<T> call, @NonNull QueryStrategy<T, C> queryStrategy,
@NonNull final IRepositoryCallback<T> callback) {
query(call, queryStrategy, callback);
query(mDefaultAccessPolicy, call, queryStrategy, callback);
}

/**
Expand Down

0 comments on commit 1923610

Please sign in to comment.