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: IntegrationHistory out of DB Watcher #32502

Merged
merged 4 commits into from
May 27, 2024

Conversation

ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented May 25, 2024

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

  • Conditionally incorporating IntegrationHistory entity import within DB watchers on application startup based on the dbWatchersDisabled flag.
  • Enabling support for the following use cases to directly trigger watch.integrationHistory listener event, subject to the dbWatchersDisabled flag.
Updated Use Cases
Use Case Route/Trigger Notes
Clear integration history POST Meteor method clearIntegrationHistory
Update history Calls to updateHistory from ScriptEngine

Steps to test or reproduce

  1. Start RocketChat's application with the DISABLE_DB_WATCHERS environment variable set to true.
  2. Perform HTTP requests or simulate use cases listed in the above table.

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 IntegrationHistory.create and IntegrationHistory.updateById.

Copy link
Contributor

dionisio-bot bot commented May 25, 2024

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 6.10.0, but it targets 6.9.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented May 25, 2024

⚠️ No Changeset found

Latest commit: a2ea383

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 25, 2024

Codecov Report

Attention: Patch coverage is 6.25000% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 56.33%. Comparing base (cd96032) to head (a2ea383).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #32502      +/-   ##
===========================================
- Coverage    56.38%   56.33%   -0.05%     
===========================================
  Files         2434     2434              
  Lines        53693    53708      +15     
  Branches     11050    11057       +7     
===========================================
- Hits         30275    30259      -16     
- Misses       20779    20803      +24     
- Partials      2639     2646       +7     
Flag Coverage Δ
e2e 56.02% <ø> (-0.05%) ⬇️
unit 72.23% <6.25%> (-0.09%) ⬇️

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

@ricardogarim ricardogarim marked this pull request as ready for review May 27, 2024 13:00
@ricardogarim ricardogarim requested review from a team as code owners May 27, 2024 13:00
@sampaiodiego sampaiodiego added this to the 6.10 milestone May 27, 2024
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label May 27, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label May 27, 2024
@kodiakhq kodiakhq bot merged commit b21d32b into develop May 27, 2024
50 checks passed
@kodiakhq kodiakhq bot deleted the refactor/integration-history-out-of-db-watcher branch May 27, 2024 21:56
gabriellsh added a commit that referenced this pull request May 28, 2024
…retention

* 'develop' of github.com:RocketChat/Rocket.Chat: (36 commits)
  refactor: IntegrationHistory out of DB Watcher (#32502)
  fix: Message update being broadcasted without updated values (#32472)
  test: make api teams test fully independent (#31756)
  test: Fix test name (#32490)
  fix: streams being called with no logged user (#32489)
  feat: Un-encrypted messages not allowed in E2EE rooms (#32040)
  feat(UiKit): Users select (#31455)
  fix: Re-login same browser tab issues (#32479)
  chore: move all webclient code out of the COSS folders (#32273)
  chore(deps): bump thehanimo/pr-title-checker from 1.3.7 to 1.4.1 (#30619)
  fix: Don't show join default channels option for edit user form  (#31750)
  fix: CAS user merge not working (#32444)
  fix: Overriding Retention Policy not working (#32454)
  fix: `rooms.export` endpoint generates an empty export when given an invalid date (#32364)
  fix: "Allow Password Change for OAuth Users" setting is not honored in the "Forgot Password" flow (#32398)
  fix: Bypass trash when removing OTR system messages and read receipts (#32269)
  fix: Monitors dissapearing from Unit upon edit (#32393)
  fix: Link image preview not opening in gallery (#32391)
  feat: Allow visitors & integrations to access downloaded files after a room has closed (#32439)
  regression: Users tab misaligned (#32451)
  ...
matheusbsilva137 pushed a commit that referenced this pull request May 31, 2024
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.

2 participants