Skip to content

Conversation

tsm-odoo
Copy link
Contributor

@tsm-odoo tsm-odoo commented Jul 29, 2024

*: hr_holidays, mail.

Before this PR, the main tab updated the user presence every minute. As a result of this update, it would also receive the IM statuses it was interested in.

However, this approach puts significant pressure on the gevent worker, especially when it handles more databases than the registry can hold.

To address this issue, this PR improves the way presences are updated:

  • Presences are sent and broadcasted when they change (e.g. away => online).
  • When a websocket disconnects, the user is considered disconnected. If other devices receive this notification, they will update the user presence immediately.

These changes greatly reduce traffic caused by presence updates while keeping the IM statuses reliable.

@robodoo
Copy link
Contributor

robodoo commented Jul 29, 2024

Pull request status dashboard

@C3POdoo C3POdoo added the RD research & development, internal work label Jul 29, 2024
@tsm-odoo tsm-odoo force-pushed the saas-17.2-bus_im_status_perf-tsm branch 2 times, most recently from 07aafb3 to 1b1f8b7 Compare July 29, 2024 10:36
@tsm-odoo tsm-odoo marked this pull request as ready for review August 1, 2024 07:37
@C3POdoo C3POdoo requested review from a team, BastienFafchamps, Julien00859 and juliusc2066 and removed request for a team August 1, 2024 07:39
@tsm-odoo tsm-odoo force-pushed the saas-17.2-bus_im_status_perf-tsm branch from 1b1f8b7 to 0b522c5 Compare August 1, 2024 10:10
Copy link
Contributor

@seb-odoo seb-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robodoo delegate+

@tsm-odoo tsm-odoo force-pushed the saas-17.2-bus_im_status_perf-tsm branch from 0b522c5 to 247e479 Compare August 1, 2024 11:00
Copy link
Contributor

@flvr-odoo flvr-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robodoo overrice=ci/security
in this case, I don't think we need cors='*' as the cross-site front-end doesn't need to read the result of the request for it to works. But it doens't hurt to avoid a cors error

@robodoo
Copy link
Contributor

robodoo commented Aug 1, 2024

@flvr-odoo unknown command 'overrice'.

For your own safety I've ignored everything in your entire comment.

Currently available commands:

command
help displays this help
r(eview)+ approves the PR, if it's a forwardport also approves all non-detached parents
r(eview)=<number> only approves the specified parents
fw=no does not forward-port this PR
fw=default forward-ports this PR normally
fw=skipci does not wait for a forward-port's statuses to succeed before creating the next one
up to <branch> only ports this PR forward to the specified branch (included)
merge integrate the PR with a simple merge commit, using the PR description as message
rebase-merge rebases the PR on top of the target branch the integrates with a merge commit, using the PR description as message
rebase-ff rebases the PR on top of the target branch, then fast-forwards
squash squashes the PR as a single commit on the target branch, using the PR description as message
delegate+ grants approval rights to the PR author
delegate=<...> grants approval rights on this PR to the specified github users
default stages the PR normally
priority tries to stage this PR first, then adds default PRs if the staging has room
alone stages this PR only with other PRs of the same priority
cancel=staging automatically cancels the current staging when this PR becomes ready
override=<...> marks overridable statuses as successful
check fetches or refreshes PR metadata, resets mergebot state

Note: this help text is dynamic and will change with the state of the PR.

@flvr-odoo
Copy link
Contributor

robodoo override=ci/security

*: hr_holidays, mail.

Before this PR, the main tab updated the user presence every minute.
As a result of this update, it would also receive the IM statuses it
was interested in.

However, this approach puts significant pressure on the gevent worker,
especially when it handles more databases than the registry can hold.

To address this issue, this PR improves the way presences are updated:
- Presences are sent and broadcasted when they change
(e.g. away => online).
- When a websocket disconnects, the user is considered disconnected. If
other devices receive this notification, they will update the user
presence immediately.

These changes greatly reduce traffic caused by presence updates while
keeping the IM statuses reliable.
@tsm-odoo tsm-odoo force-pushed the saas-17.2-bus_im_status_perf-tsm branch from 247e479 to bd62360 Compare August 1, 2024 12:20
@tsm-odoo
Copy link
Contributor Author

tsm-odoo commented Aug 1, 2024

@robodoo r+

Atovange added a commit to odoo-dev/odoo that referenced this pull request Mar 18, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.
robodoo pushed a commit that referenced this pull request Mar 20, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes #199936

Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
Atovange added a commit to odoo-dev/odoo that referenced this pull request Mar 25, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

X-original-commit: ff16614
robodoo pushed a commit that referenced this pull request Mar 28, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes #202776

X-original-commit: ff16614
Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
Atovange added a commit to odoo-dev/odoo that referenced this pull request Mar 31, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

X-original-commit: 11f92be
robodoo pushed a commit that referenced this pull request Apr 1, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes #203903

X-original-commit: 11f92be
Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
Atovange added a commit to odoo-dev/odoo that referenced this pull request Apr 1, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

X-original-commit: 01df2f7
robodoo pushed a commit that referenced this pull request Apr 2, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes #204307

X-original-commit: 01df2f7
Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
Atovange added a commit to odoo-dev/odoo that referenced this pull request Apr 8, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

X-original-commit: c74ef6a
robodoo pushed a commit that referenced this pull request Apr 8, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes #204485

X-original-commit: c74ef6a
Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Apr 8, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

X-original-commit: f443933
robodoo pushed a commit that referenced this pull request Apr 9, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes #205269

X-original-commit: f443933
Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
gamarino pushed a commit to numaes/numa-public-odoo that referenced this pull request Apr 26, 2025
Before this commit, the IM status icon shown when the user is
homeworking won't always be precise. This happens because of the IM
status refactoring (odoo/odoo#174814).

Steps to reproduce:
1. Setup user Marc Demo as homeworking in the current day
2. As Marc Demo open Discuss
3. As Mitchell Admin open the conversation with Marc Demo -> the
correct home online icon is shown
4. As Marc Demo close all Odoo tabs -> user goes offline and Mitchell
Admin sees the correct offline icon
5. As Marc Demo reopen Discuss -> Mitchell Admin sees the circle icon
instead of the home icon

This commit fixes the issue by sending the user im_status information
directly from its indentity model (`res.partner` or `mail.guest`) in
the `bus.bus/im_status_updated` notification payload. This ensures
that any overrides on the `im_status` field will be taken into
consideration without having to re-establish the override client side.
`presence_status` now represents the status value of the presence
model, while `im_status` represents the status value of the identity
model.

closes odoo/odoo#203903

X-original-commit: 11f92becef55dc2994b5a63bc0951867b9ff3349
Signed-off-by: Giorgio Tocco (gito) <gito@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants