Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Apr 16, 2025

Proposed changes (including videos or screenshots)

Issue(s)

https://rocketchat.atlassian.net/browse/CTZ-42

Steps to test or reproduce

Further comments

We improved the way we check the chat limits an agent is bound to. As the process is (should be, at least) faster and more intelligent, we need to improve it on all the routing mechanisms we have.

Currently, Auto Selection was the only one with the "optimized" process to ignore unavailable users. Now, this extends that to the other 2.

Should prevent issues caused by the algorithm selecting an agent that is out of limits, just for the server to realize this and cancel the assignment.
This is not a problem for autoselection or load rotation, where the "last assignment" is set at the moment the user is selected, but on load balancing, this depends on the user being actually assigned to the chat so others (with less load) can be picked, and since the user was not being assigned, then the algo returned the same user (less load) over and over until the situation changed and other agent was selected. :dum:


This pull request introduces a feature to apply chat limits on enterprise routing algorithms within the Rocket.Chat live chat system. The changes include refactoring the logic for applying simultaneous chat restrictions by extracting it into a separate function, getChatLimitsQuery, and updating the callback to utilize this function. Additionally, the getNextAgent method in both the LoadBalancing.ts and LoadRotation.ts files has been modified to incorporate new logic for handling unavailable users based on these chat limits. This enhancement aims to improve the efficiency of agent routing by considering chat limits when determining agent availability.


This pull request introduces a feature to apply chat limits on enterprise routing algorithms within the Rocket.Chat platform. The changes include:

  1. A new changeset file documenting a patch for the '@rocket.chat/meteor' package, specifically addressing issues with enterprise routing algorithms.
  2. Refactoring of the logic for applying simultaneous chat restrictions in the live chat system. The query logic has been extracted into a separate function to enhance modularity and maintainability.
  3. Modifications to the LoadBalancing.ts file, where the getNextAgent method now includes additional logic to handle unavailable users based on chat limits.
  4. Updates to the LoadRotation.ts file, introducing a new import for getChatLimitsQuery and utilizing it in the getNextAgent method to filter out unavailable users according to chat limits.

These changes aim to improve the efficiency and reliability of the chat routing process in enterprise environments by enforcing chat limits.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Apr 16, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Apr 16, 2025

🦋 Changeset detected

Latest commit: c3e33e6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kody-ai
Copy link

kody-ai bot commented Apr 16, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kody-ai
Copy link

kody-ai bot commented Apr 16, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@KevLehman KevLehman changed the title feat: Apply chat limits on enterprise Routing Algorithms fix: Apply chat limits on enterprise Routing Algorithms Apr 16, 2025
@codecov
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.17%. Comparing base (bbd0b0d) to head (c3e33e6).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #35831   +/-   ##
========================================
  Coverage    61.16%   61.17%           
========================================
  Files         2971     2971           
  Lines        70838    70838           
  Branches     16184    16184           
========================================
+ Hits         43330    43337    +7     
+ Misses       24559    24552    -7     
  Partials      2949     2949           
Flag Coverage Δ
e2e 57.70% <ø> (+0.01%) ⬆️
unit 75.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kody-ai
Copy link

kody-ai bot commented Apr 16, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@renatobecker renatobecker added this to the 7.6.0 milestone Apr 17, 2025
@renatobecker renatobecker added the stat: QA assured Means it has been tested and approved by a company insider label Apr 17, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 17, 2025
@KevLehman KevLehman marked this pull request as ready for review April 17, 2025 13:35
@KevLehman KevLehman requested review from a team as code owners April 17, 2025 13:35
@github-actions
Copy link
Contributor

github-actions bot commented Apr 17, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35831/

Built to branch gh-pages at 2025-04-18 01:46 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@kody-ai
Copy link

kody-ai bot commented Apr 17, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kody-ai
Copy link

kody-ai bot commented Apr 18, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kodiakhq kodiakhq bot merged commit 1c839a3 into develop Apr 18, 2025
48 checks passed
@kodiakhq kodiakhq bot deleted the feat/limits-on-autorouting branch April 18, 2025 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants