Skip to content

Commit 077115d

Browse files
committed
perf(notifier): project only notifications field when loading rules
1 parent 3529d73 commit 077115d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

workers/notifier/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,12 @@ export default class NotifierWorker extends Worker {
193193
*/
194194
private async getProjectNotificationRules(projectId: string): Promise<Rule[]> {
195195
const connection = this.accountsDb.getConnection();
196-
const projects = connection.collection('projects');
196+
const projects = connection.collection<{ notifications?: Rule[] }>('projects');
197197

198-
const project = await projects.findOne({ _id: new ObjectID(projectId) });
198+
const project = await projects.findOne(
199+
{ _id: new ObjectID(projectId) },
200+
{ projection: { notifications: 1 } }
201+
);
199202

200203
if (!project) {
201204
throw new Error('There is no project with given id');

0 commit comments

Comments
 (0)