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

Background insert doesn't update stream in foreground when opened #2768

Closed
typexy opened this issue Dec 3, 2023 · 2 comments
Closed

Background insert doesn't update stream in foreground when opened #2768

typexy opened this issue Dec 3, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@typexy
Copy link

typexy commented Dec 3, 2023

I have an app with a chat page. The chat page itself is grouped by rooms, e.g. another user. When the chat screen is opened and I receive a message, it works fine, also when the app is closed and I receive a message and I open the chat page it is updated properly.

But when the app is in background with a given chat page, e.g. with USER1 and a message is received and stored and I open the chat page, the stream is not updated properly. I think it is due to the fact that stream queries are cached and in the background it isn't synced. Because when I query the messages without stream as soon as the chat page is opened, it works fine.

Is it possible to force the stream implementation to "query" and not to use the cache somehow? Or is there another solution to trigger the stream to sync it?

Otherwise I would have to do an implementation that updates the messages in the chat page with the future query instead of the stream query and then starting the stream again.

@typexy typexy added the enhancement New feature or request label Dec 3, 2023
@simolus3
Copy link
Owner

simolus3 commented Dec 3, 2023

Is it possible to force the stream implementation to "query" and not to use the cache somehow? Or is there another solution to trigger the stream to sync it?

You can use this on your database to update all streams manually:

db.notifyUpdates(
    {for (final table in db.allTables) TableUpdate.onTable(table)});

I think it is due to the fact that stream queries are cached and in the background it isn't synced

They are being cached, but that cache should invalidate after a write to the database. Are you using a separate database connection for the writes in the background?

@simolus3
Copy link
Owner

Closing this since I can't act on this without further information. Let me know if you still run into this (and also share how the writes are happening so that I have a starting point to look into).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants