-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
refactor: LivechatDepartmentAgents out of DB Watcher #32504
refactor: LivechatDepartmentAgents out of DB Watcher #32504
Conversation
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #32504 +/- ##
===========================================
- Coverage 56.36% 56.36% -0.01%
===========================================
Files 2435 2432 -3
Lines 53710 53704 -6
Branches 11062 11059 -3
===========================================
- Hits 30273 30268 -5
- Misses 20791 20796 +5
+ Partials 2646 2640 -6
Flags with carried forward coverage won't be shown. Click here to find out more. |
… with dept agents
…dept-agent-out-of-db-watcher
4a4664e
to
8408c78
Compare
As per the updates mentioned in PROJ-7, SCA-8 and ADR #74, this pull request focuses on relocating
LivechatDepartmentAgents
model out of DB Watcher service.Context
This modification enhances RocketChat's app by allowing it to directly call listeners through the
api.broadcast
global function, bypassing the need for MongoDB Change Stream data propagation.This change offers better control over user notifications via Web Sockets, enabling more precise management of use-cases. Instead of notifying every database change, we can now send an
api.broadcast
call only when necessary, reducing overall network messages. Additionally, this contributes to the future removal of the DB Watcher deployment, optimizing resource utilization.Proposed changes
Key changes include:
dbWatchersDisabled
flag.watch.livechatDepartmentAgents
listener event, subject to thedbWatchersDisabled
flag.deleteUser
deleteUserOwnAccount
livechat.afterAgentRemoved
triggered byDELETE
/api/v1/livechat/users/:type/:_id
POST Meteor method
livechat:removeAgent
/api/v1/livechat/department/:_id/archive
POST
/api/v1/livechat/department/:_id/unarchive
livechat:removeDepartment
DELETE
/api/v1/livechat/department/:_id
Steps to test or reproduce
Further comments
To maintain consistency and avoid potential regressions, event names and signatures have been kept unchanged on both the client and app sides. This decision streamlines efforts and mitigates the risk of unintended consequences.
Additionally, some new model functions have been created to accommodate specific needs when dealing with database operations, such as
LivechatDepartmentAgents.findAgentsByAgentsAndDepartmentId
.