Skip to content
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: LivechatInquiry out of DB Watcher #32358

Merged
merged 17 commits into from
Jun 21, 2024

Conversation

ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented May 1, 2024

As per the updates mentioned in PROJ-7, SCA-7 and ADR #74, this pull request focuses on relocating LivechatInquiry 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 propagation

Why 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:

  • Conditionally incorporating LivechatInquiry entity import within DB watchers on application startup based on the dbWatchersDisabled flag.
  • Enabling support for the following use cases to directly trigger watch.inquiries listener event, subject to the dbWatchersDisabled flag.
Updated use cases.
Use Case Route/Trigger Notes

Steps to test or reproduce

  1. Start RocketChat's application with the DISABLE_DB_WATCHERS flag set to true.
  2. Perform a POST request to above given endpoints available on updated use cases.
  3. Observe websocket received events. Related events should be of one of the below mentioned types, containing all changed fields as well as the updated permission identification data.
Event name Trigger
${inquiry._id} clientAction = removed or updated
department/${inquiry.department} clientAction = removed or updated and inquiry has a department
public clientAction = removed or updated and inquiry and inquiry doesn't have a department

All socket notifications come with the prefix livechat-inquiry-queue-observer.

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.

Copy link
Contributor

dionisio-bot bot commented May 1, 2024

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

Copy link

changeset-bot bot commented May 1, 2024

⚠️ No Changeset found

Latest commit: 18ce4c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 6.06061% with 31 lines in your changes missing coverage. Please review.

Project coverage is 56.50%. Comparing base (8ac631d) to head (18ce4c6).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #32358      +/-   ##
===========================================
- Coverage    56.54%   56.50%   -0.04%     
===========================================
  Files         2484     2480       -4     
  Lines        54749    54731      -18     
  Branches     11308    11314       +6     
===========================================
- Hits         30958    30928      -30     
- Misses       21113    21134      +21     
+ Partials      2678     2669       -9     
Flag Coverage Δ
e2e 56.18% <ø> (-0.04%) ⬇️
unit 71.98% <6.06%> (-0.11%) ⬇️

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

@ricardogarim ricardogarim changed the title refactor: LivechatInquiry out of DB Watcher refactor: Livechat inquiries out of DB Watcher May 2, 2024
@ricardogarim ricardogarim changed the title refactor: Livechat inquiries out of DB Watcher refactor: LivechatInquiry out of DB Watcher May 2, 2024
@ricardogarim ricardogarim force-pushed the refactor/livechat-inquiries-out-of-db-watcher branch 2 times, most recently from 63fbc5a to cfb85c4 Compare May 17, 2024 00:33
@ricardogarim ricardogarim marked this pull request as ready for review May 17, 2024 11:57
@ricardogarim ricardogarim requested review from a team as code owners May 17, 2024 11:57
@ricardogarim ricardogarim force-pushed the refactor/livechat-inquiries-out-of-db-watcher branch from 7a6a36b to aac311c Compare May 31, 2024 14:07
@ricardogarim ricardogarim force-pushed the refactor/livechat-inquiries-out-of-db-watcher branch from e77133e to 57654d3 Compare May 31, 2024 18:34
@sampaiodiego sampaiodiego force-pushed the refactor/livechat-inquiries-out-of-db-watcher branch from 3c66efe to 5a4a5ee Compare June 19, 2024 23:15
sampaiodiego
sampaiodiego previously approved these changes Jun 20, 2024
sampaiodiego
sampaiodiego previously approved these changes Jun 20, 2024
@sampaiodiego sampaiodiego added this to the 6.10 milestone Jun 20, 2024
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Jun 20, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 20, 2024
@ggazzo ggazzo merged commit 2ad192b into develop Jun 21, 2024
48 checks passed
@ggazzo ggazzo deleted the refactor/livechat-inquiries-out-of-db-watcher branch June 21, 2024 02:09
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.

3 participants