-
- Downloads
[FIX] bus: do not receive all longpolling notifs after disconnect
Revision on bus refactoring: https://github.com/odoo/odoo/commit/6448420c5dd160470e465dee7729d19d8d5e7bab Before this commit, when a user was disconnected for a very long time, he would receive lots of chat notifications on his next login. Here is an example of weird behaviour with this issue: - User folds and unfolds a chat window 50 times - User disconnects for more than 50 seconds - User reconnects ==> the chat window rapidly folds and unfolds itself 50 times! This issue comes from the fact that after 50 seconds without any longpolling, the web client ignores the last tracked notification and sents the ID `-1` to the server. The web client always provides a notification ID to the server on a `longpolling/poll`. Usually, the server returns all notifications of the user with an ID greater than the provided ID. There is an exception with ID `0`, in which all notifications since the last connection of the user are returned. The cause of the issue is a mismatch of the special notification ID between the server and the web client. For the web client, the ID `-1` is used for not tracking any notification, whereas the server uses the ID `0` for this case. As a result, when the server receives the value `-1`, it returns all notifications having an ID greater than `-1`. In other words, it returns all notifications related to this user, even the ones received long time ago! This commit fixes the issue by enforcing the special notification ID `0` on both the webclient and server. Note that this logic is similar to 11.0: - The webclient uses the ID `-1` most of the time to define 'untracked': https://github.com/odoo/odoo/blob/11.0/addons/bus/static/src/js/bus.js#L154 - However, it passes the ID `0` to the server: https://github.com/odoo/odoo/blob/11.0/addons/bus/static/src/js/bus.js#L193
Please register or sign in to comment