From dd4270397dd41ce67e6e767fbdaa0c0534fbeee3 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 31 Jul 2024 23:35:58 -0600 Subject: [PATCH] chore: Use index on `unlockAll` query called when changing OM routing methods (#32860) --- apps/meteor/server/models/raw/LivechatInquiry.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/meteor/server/models/raw/LivechatInquiry.ts b/apps/meteor/server/models/raw/LivechatInquiry.ts index 3178d217be4f..52aedd0585f8 100644 --- a/apps/meteor/server/models/raw/LivechatInquiry.ts +++ b/apps/meteor/server/models/raw/LivechatInquiry.ts @@ -154,10 +154,7 @@ export class LivechatInquiryRaw extends BaseRaw implemen }, }, { - locked: false, - }, - { - locked: { $exists: false }, + locked: { $ne: true }, }, ], }, @@ -189,7 +186,7 @@ export class LivechatInquiryRaw extends BaseRaw implemen async unlockAll(): Promise { return this.updateMany( - { $or: [{ lockedAt: { $exists: true } }, { locked: { $exists: true } }] }, + { locked: { $exists: true } }, { $unset: { locked: 1, lockedAt: 1 }, $set: { status: LivechatInquiryStatus.QUEUED, queuedAt: new Date() } }, ); }