-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a system to refresh all cached products for Nutri-Score v2 #4545
Comments
About the refresh of local products:
Beyond that is the problem of using 2 nutriscores for the same product. |
The good thing is that we already have a background task that refreshes all the local products: @teolemon @stephanegigandet Would the server be ready to provide us with a URL like
|
We should probably weight how much complexity we add versus the benefits we get. Having an old Nutri-Score in the local cache may not be a big problem, especially if we refresh those items when they actually get displayed to the user. We could just consider that the local cache is just a cache, that it can be outdated (it's already the case for any other edit to the product page), and that it's ok. Under what conditions / actions do we use the local cache? If I have network connectivity, do we just always get fresh content anyway? |
@stephanegigandet Actually we use the local cache (local SQLite database) as the main source. Instant results. What we could do do implement a lazy refresh, is to async'ly download the product each time we go to the product page - while still displaying the local cache version. After the product is successfully re-downloaded, the displayed data will be refreshed. |
I think whenever we reopen the product page, we should attempt to refresh, and flash the content whenever that happens (possibly with an animated transition) |
That wouldn't be a problem: we already have a I'm a bit worried about how to prevent cluttering, as we use a single queue for our background tasks. And about low connectivity context. Perhaps we could add this in dev mode only first, in order to monitor it. |
Keep in mind I am not up to date with the current background manager implementation, but we could add a kind of priority system, so that things like this are always executed first. + Other use: when a query fails (image too small) we could downgrade its importance so that other working queries are not blocked forever |
Given how the background manager works and the pain in the neck it would be to amend it (assuming that the concept of priority would be helpful), a moderately easy way to implement a priority could be to use 2 managers, one for fast queries (like product refresh) and one for slower queries (like image upload).
|
cf. #5016 (comment)
We can easily have all the products refreshed: we would just need to clear all local products "download language" field, and start a fake "app language change background task". Regarding "normal" users, the trick would be to check a one-shot preference value at init time (e.g. "if 0 then set to 1 and refresh all products"). Possibly with a date check "only if date is after April 1st 2024". |
It has been a while, I guess the nutriscore v2 was rolled out already. Is this still a concern @teolemon |
What
Tasks
Part of
The text was updated successfully, but these errors were encountered: