Skip to content
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

An issue with background tasks? #4564

Closed
g123k opened this issue Aug 17, 2023 · 9 comments · Fixed by #4584
Closed

An issue with background tasks? #4564

g123k opened this issue Aug 17, 2023 · 9 comments · Fixed by #4584
Assignees
Labels
🐛 bug Something isn't working

Comments

@g123k
Copy link
Collaborator

g123k commented Aug 17, 2023

Hi everyone,

We have a rapport on Slack on the history list, with many products having an error:

Adding new products and looking them afterwards in the app, shows as the product does not exist, but in about 1-2 days the product is added.
💡 Could you add some "Processing" or "Storing" label instead?

What he did:

Discovered new products, added pictures and product title

Screen_Recording_20230817_111548.mp4
@g123k g123k added the 🐛 bug Something isn't working label Aug 17, 2023
@monsieurtanuki
Copy link
Contributor

@g123k If you create a new product, it will be sent to the server in a background task, after all the previous background tasks. That may explain a delay between the creation on the app and the creation on the server, especially with low connection and many images.
When we refresh a product list, we retrieve data from the server. In the case the data is not yet on the server, that would explain why we see an "unknown product" card.
=> a solution would be to fix the specific "refresh list from server" feature and handle the case when the product is not found on the server but is available locally

More generally speaking, as long as we consider that the background tasks as a black box that always succeeds immediately regardless of the connection or of the server, we'll have potential confusion in the app.
That's why I suggested many times to make background tasks more visible, like the "download history" button on web browsers. This idea is not very popular, and anyway we would have to find a correct place to put that feature.

@monsieurtanuki monsieurtanuki self-assigned this Aug 17, 2023
@g123k
Copy link
Collaborator Author

g123k commented Aug 18, 2023

@teolemon This is the issue I told you yesterday.

@teolemon
Copy link
Member

teolemon commented Aug 18, 2023

A simple rewording would probably be the best solution. It would need an heuristic to set it apart from deleted products and Moved to OxF products
"This product is being sent. Refresh when your online to see the details"

@monsieurtanuki
Copy link
Contributor

A simple rewording would probably be the best solution. It would need an heuristic to set it apart from deleted products and Moved to OxF products "This product is being sent. Refresh when your online to see the details"

We don't even need a rewording. We just need to fix the list refresh: if the product is not on the server but is in local, display the local version.

@teolemon
Copy link
Member

@monsieurtanuki Then we need to explain why no scores, no knowledge panels. ("Scores and information will appear when this product is actually sent to the Open Food Facts server")

@monsieurtanuki
Copy link
Contributor

@monsieurtanuki Then we need to explain why no scores, no knowledge panels. ("Scores and information will appear when this product is actually sent to the Open Food Facts server")

@teolemon We need to do that everywhere in the app when there's a product, even "old" products: if I change the category and expect a dramatic nutriscore change that I cannot see, it's because the product has not been uploaded to/refreshed from the server side. Could be a simple red banner like "pending changes...".

I'll have a go with that banner feature, while fixing the current bug.

@teolemon
Copy link
Member

Well, we should never be in the case where we have 90% plus of old banners, especially as the Nutri-Score is about to change.
Ideally, The server would notify the app on updated products. Until we have that, either red banners everywhere, or agressive reloading client side. Any other options ?
cc @stephanegigandet since this topic already came on the table last week in the Product Opener regarding Nutri-Score.

@monsieurtanuki
Copy link
Contributor

@teolemon The "old banners" would only be displayed for products that the user changed locally and whose changes have not been uploaded yet.
Special case for the current issue, with products that the user created and whose changes have not been uploaded yet.
So unless the user just created or changed 90% of the products of the list, you won't see 90% of old banners.
Anyway, here we only care about which local changes were not committed yet.

You're mentioning another refresh issue: how do we know if a product changed on the server. That's something different.
We already evoked that with @stephanegigandet years ago, and if I remember well a solution would have been to implement some eTag on the server side for each product change (+ algorithm change).
We would from time to time ping the server "what is the eTag of that barcode?", and compare that to the local eTag.
We could download all local products' eTags at app start, and download only the products where the eTag changed.

@teolemon
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants