From 6d5cc5e0ef2f58a8ea63d5834dec83596e744050 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 8 Apr 2024 14:54:31 -0300 Subject: [PATCH] chore: remove collections when db watcher is disabled (#32150) --- apps/meteor/server/database/watchCollections.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/meteor/server/database/watchCollections.ts b/apps/meteor/server/database/watchCollections.ts index 8b667e921f1f..34d0bb795b0b 100644 --- a/apps/meteor/server/database/watchCollections.ts +++ b/apps/meteor/server/database/watchCollections.ts @@ -1,3 +1,4 @@ +import { dbWatchersDisabled } from '@rocket.chat/core-services'; import { Messages, Users, @@ -29,7 +30,6 @@ const onlyCollections = DBWATCHER_ONLY_COLLECTIONS.split(',') export function getWatchCollections(): string[] { const collections = [ - Messages.getCollectionName(), Users.getCollectionName(), Subscriptions.getCollectionName(), LivechatInquiry.getCollectionName(), @@ -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)); }