tsm-odoo 6ec80202ec [IMP] im_livechat: speed up operator selection
Since #135113, calls to /im_livechat/get_session can become very
expensive on large databases with a long history of livechat sessions.
Operators who have thousands of past livechat sessions (channels) can
cause the SQL query in get_operator() to take multiple seconds.

When the livechat is set to auto-popup and there are lots of visitors,
this can become very significant.

This patch changes two aspects:
- introduce a CTE for the RTC session part, in order to avoid a
  JOIN cardinality between livechat channels and channel_members - we
  only care about channel membership for a RTC session
- restrict the selection of livechat channels created within the last 24h,
  considering that we only care about messages sent in the last 30
  minutes anyway

The second part may change the result ordering in the present of old
channels (>24h) with recent messages - but that is rather unlikely, and
an operator will be selected anyway.

This change makes a huge difference on a database with 300k livechat
channels and 1 million `discuss_channel_member` records, from several
seconds to >50ms. The results are identical or extremely similar in most
cases, and the database only needs to look at a few hundred records
instead of millions.

closes odoo/odoo#150968

Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
2024-02-06 18:48:56 +00:00
2024-02-05 07:24:23 +00:00
…
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%