Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Discover doesn't update, can't refresh #1010

Closed
xmatthewx opened this issue Feb 22, 2016 · 9 comments
Closed

Discover doesn't update, can't refresh #1010

xmatthewx opened this issue Feb 22, 2016 · 9 comments
Labels
Milestone

Comments

@xmatthewx
Copy link

Pull-to-refresh no longer works in the Discover view.

The most recently featured projects do not appear in Discover (even after 2 weeks). Cache doesn't seem to expire. This second issue might not be new ... might have been hidden by the ability to use pull-to-refresh.

cc @ryanwse @alanmoo @gvn

@xmatthewx xmatthewx added the bug label Feb 22, 2016
@xmatthewx xmatthewx added this to the 1.6.0 milestone Feb 22, 2016
@ryanwarsaw
Copy link
Contributor

Dupe of #931

It broke with the crosswalk update, I'll see what I can do about fixing it.

@xmatthewx
Copy link
Author

Pull-to-refresh itself isn't essential. When a user returns to the view, we need to check the server to make sure the cache is recent enough.

@ryanwarsaw
Copy link
Contributor

@xmatthewx Oh, okay. I'll take a look at that, seems pretty straight forward though.

@alanmoo
Copy link
Contributor

alanmoo commented Mar 2, 2016

After looking through the code with @xmatthewx, I feel like it's pretty likely there's been a caching issue from the start, and that we simply didn't notice it because pull-to-refresh was there. It seems what we really need is a timeout on the cache. https://github.com/mozilla/webmaker-core/blob/develop/src/lib/api.js#L47-L88 may be the culprit, as it seems that if a cache exists, it will always be used. If we can add a way to check the date of the stored cache and throw it out if it's older than X hours (or doesn't have a time stamp at all), that should take care of the issue.

@xmatthewx
Copy link
Author

Thanks for the notes @alanmoo. I discussed this with @ryanwse. Here's the basic plan:

We'll make sure we're storing a timestamp with the cache, and check that on view load. For now, a simple expiration after one hour will be good enough.

Feature updates are done manually and not frequently. We just need to unlock permanent cache and prevent constant unnecessary updates. In a future release, if needed, we can actually fetch a small update to test the cache against.

@ryanwarsaw
Copy link
Contributor

I looked at this in-depth today, the app appears to be showing 19 project entries in the discovery page, and I also get 19 entries when I query the /discover route of the staging API. This would suggest that there is either an issue with how moderators are attempting to feature projects, or how the API is handling those requests.

I'd also like to note that in further testing, I can confirm there is no issue in regards to how caching works in Webmaker for Android, as it uses the LruCache caching system, a cache designed to organize information within it in order of how often its accessed, in order to improve speed & efficiency. This caching system is memory based, and is thrown away when the app is closed (along with the data).

@xmatthewx
Copy link
Author

I just featured 2 more projects on the staging DB. You should now see 21. Let's schedule a time to talk over video to see if we can reproduce the error. My beta app on device still doesn't display the most recently featured projects.

@xmatthewx
Copy link
Author

Problem appears to be with cache on the server. API doesn't return all the projects marked as featured in the DB. No obvious pattern with the missing projects. Most likely they were just featured later than the others.

@xmatthewx
Copy link
Author

Closing. This is not a bug. More of a planning flaw. (Sigh) See #1016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants