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: LivechatPriority out of DB Watcher #32362
refactor: LivechatPriority out of DB Watcher #32362
Conversation
Looks like this PR is ready to merge! 🎉 |
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #32362 +/- ##
===========================================
+ Coverage 55.75% 55.76% +0.01%
===========================================
Files 2413 2413
Lines 53180 53186 +6
Branches 10932 10934 +2
===========================================
+ Hits 29649 29659 +10
- Misses 20908 20909 +1
+ Partials 2623 2618 -5
Flags with carried forward coverage won't be shown. Click here to find out more. |
…d change model import rule on watched collections
83a02e4
to
e6e7cbc
Compare
As per the updates mentioned in PROJ-7 SCA-4 and ADR #74, this pull request focuses on relocating LivechatPriority entity out of DB Watcher service.
Quick context to public readers
In essence, this modification empowers RocketChat's app to directly call listeners through the
api.broadcast
global function, eliminating the reliance on MongoDB Change Stream data propagationWhy is this beneficial? It provides better control over notifying users by enabling more precise use-case management. Unlike Change Streams, which notify every action on Mongo's documents and sometimes might result in unnecessary duplicate notifications. Moreover, it contributes to the future removal of the DB Watcher deployment, thereby optimizing resource utilization.
Proposed changes
Key changes include:
dbWatchersDisabled
flag.watch.priorities
listener event, subject to thedbWatchersDisabled
flag.resetPriorities
method response to comply with same name use case needs (POST route tolivechat/priorities.reset
). I found appropriate to update raw method since there is just one calling origin.Also, found some
createDefaultPriorities
actions but didn't refactored it since it is a startup event.Updated use cases.
livechat/priorities/:priorityId
livechat/priorities.reset
Steps to test or reproduce
DISABLE_DB_WATCHERS
flag set to true.POST
request to above given endpoints available on updated use cases.eventName: omnichannel.priority-changed
, containing all changed fields as well as the updated priority identification data.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.
LivechatPriority model WBS. Used to guide changes discovery.
🔄 Work in progress
✅ Done
➖ Not applicable