chore: remove collections when db watcher is disabled (#32150)

pull/32068/head
Diego Sampaio 2 years ago committed by GitHub
parent e2d05e92d7
commit 6d5cc5e0ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      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));
}

Loading…
Cancel
Save