refactor: Roles out of DB Watcher#32280
Conversation
|
|
Looks like this PR is ready to merge! 🎉 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #32280 +/- ##
===========================================
+ Coverage 55.52% 55.55% +0.02%
===========================================
Files 2401 2404 +3
Lines 52860 52892 +32
Branches 10856 10862 +6
===========================================
+ Hits 29352 29385 +33
+ Misses 20907 20905 -2
- Partials 2601 2602 +1
Flags with carried forward coverage won't be shown. Click here to find out more. |
…and-settings-out-of-db-watcher
As per the updates mentioned in PROJ-7 SCA-4 and ADR #74, this pull request focuses on relocating Roles 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.broadcastglobal 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:
dbWatchersDisabledflag.roles.updateandroles.createroutes to directly trigger thewatch.roleslistener event, subject to thedbWatchersDisabledflag (please check above section of updated use cases).Updated use cases.
I didn't find references to Meteor's method deleteRoom (apps/meteor/app/authorization/server/methods/deleteRole.ts) so I didn't add listener call there.
Steps to test or reproduce
DISABLE_DB_WATCHERSflag set to true.POSTrequest to the endpointsapi/v1/roles.create,api/v1/roles.update, orapi/v1/roles.delete.roles, containing all changed fields as well as the updated role identification data.Further comments
While further exploration might reveal additional use cases regarding DB operations and Roles entity interaction, it's important to note that certain events, such as startup events in RocketChat Enterprise Edition or server setup initiation, are not appropriate for notification via the Listener service. Therefore, they should not be linked to trigger an event through api.broadcast calls.
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, considering time constraints and the absence of tests for this core server component, this direction was chosen as the most pragmatic approach.
Roles model WBS. Used to guide changes discovery.
🔄 Work in progress
✅ Done
➖ Not applicable