Store icon indicating copy to clipboard operation
Store copied to clipboard

Request is made multiple times

Open marcin-adamczewski opened this issue 6 years ago • 0 comments

Hi,

I'm testing your library and have noticed that when store.get() is called multiple times in the same time, then the request is made also multiple times, despite having either memory cache or persister.

Steps to reproduce using sample app:

  1. Open PersistingStoreActivity
  2. Change persistedStore.get() method to
persistedStore
                .getWithResult(awwRequest)
                .map(result -> {
                    Log.d("lol", result.source().toString());
                    return result.value();
                })

In order to see the source. 3. In onResume() method call loadPosts(); method multiple times instead of one time. 4. Logs prints NETWORK multiple times.

Make sure to make a clean app install as there is a persister added or remove persister and add memory cache. I've noticed that inFlightRequests didn't cache the first Single.

PS I had to change baseUrl to .baseUrl("https://reddit.com/") for sample app to work on Android 8 as it required https instead of http.

marcin-adamczewski avatar Oct 28 '19 13:10 marcin-adamczewski