-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Cannot update a record with pending changes #5824
Comments
Thanks for evaluating that, @KotoriMinami. |
@diegolmello Maybe this is possible?
Additionally, I'm not quite sure about the role of |
@KotoriMinami Thanks. That's promising! This code is a little bit harder to read than it should, because of a performance improvement to make messages to be saved in batches of 1 second. Without it, every message coming from websocket would be saved on WatermelonDB directly. Can you remove everything related to the queue and give it a try? |
@diegolmello Yes, I think using a queue to handle this logic is reasonable. I'm confident that using a queue will be much more effective than directly calling updateMessage within handleMessageReceived. I only had this question because I noticed that You can try simulating a time consuming operation before
If a new websocket push is received during the waiting period, Of course, this simulated scenario is quite extreme, and the likelihood of it happening in reality is extremely low. After a simple test, the above code is able to handle this situation without losing the latest updates. After all, the current code logic has been running for four years. |
Description:
Some messages within the conversation encounter the following issues.
Environment Information:
Steps to reproduce:
Expected behavior:
Within the conversation, messages can be updated and further actions can be performed.
Actual behavior:
There's a probability that a certain batch of messages may not update correctly.
Additional context:
After examining the logs, it is suspected that the issue is caused by the following:
In the
Rocket.Chat.ReactNative/app/lib/methods/subscriptions/room.ts
Line 314 in bb59d98
All creations and updates are stored in
Rocket.Chat.ReactNative/app/lib/methods/subscriptions/room.ts
Line 244 in bb59d98
If there is a slightly long-running task when executing
Rocket.Chat.ReactNative/app/lib/methods/subscriptions/room.ts
Line 332 in bb59d98
before reaching
db.batch
,Rocket.Chat.ReactNative/app/lib/methods/subscriptions/room.ts
Line 341 in bb59d98
because
Rocket.Chat.ReactNative/app/lib/methods/subscriptions/room.ts
Line 327 in bb59d98
the next timer execution may be triggered.
At this point,
Rocket.Chat.ReactNative/app/lib/methods/subscriptions/room.ts
Line 320 in bb59d98
the creation and updates from the previous batch will be lost,
causing them to not reach the
db.batch
method.As a result, Model._preparedState will remain in an executing state in memory and will never recover.
Consequently, this batch of messages will not receive any updates.
The text was updated successfully, but these errors were encountered: