Skip to content

Commit

Permalink
chore: remove collections watched when db watcher is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Apr 8, 2024
1 parent e2d05e9 commit 6f01926
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/meteor/server/database/watchCollections.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dbWatchersDisabled } from '@rocket.chat/core-services';
import {
Messages,
Users,
Expand Down Expand Up @@ -29,7 +30,6 @@ const onlyCollections = DBWATCHER_ONLY_COLLECTIONS.split(',')

export function getWatchCollections(): string[] {
const collections = [
Messages.getCollectionName(),
Users.getCollectionName(),
Subscriptions.getCollectionName(),
LivechatInquiry.getCollectionName(),
Expand All @@ -47,6 +47,11 @@ export function getWatchCollections(): string[] {
LivechatPriority.getCollectionName(),
];

// add back to the list of collections in case db watchers are enabled
if (!dbWatchersDisabled) {
collections.push(Messages.getCollectionName());
}

if (onlyCollections.length > 0) {
return collections.filter((collection) => onlyCollections.includes(collection));
}
Expand Down

0 comments on commit 6f01926

Please sign in to comment.