-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix!: Update statuses for stuck Omnichannel rooms via migration #32131
Conversation
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 2197520 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #32131 +/- ##
========================================
Coverage 55.84% 55.85%
========================================
Files 2432 2432
Lines 53480 53480
Branches 10993 10993
========================================
+ Hits 29868 29871 +3
+ Misses 20973 20971 -2
+ Partials 2639 2638 -1
Flags with carried forward coverage won't be shown. Click here to find out more. |
2454d74
to
2197520
Compare
// 2. Remove subscriptions associated with them | ||
|
||
// Closed rooms with open inquiries | ||
const closedRooms = await LivechatRooms.find({ closedAt: { $exists: true } }, { projection: { _id: 1 } }).toArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query takes a long time for cases with a lot of omnichannel conversations. Example with 1 million.
|
||
// Closed rooms with open inquiries | ||
const closedRooms = await LivechatRooms.find({ closedAt: { $exists: true } }, { projection: { _id: 1 } }).toArray(); | ||
const { deletedCount } = await LivechatInquiry.deleteMany({ rid: { $in: closedRooms.map((room) => room._id) } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With same case above this could fail because of the size of the array being returned
console.log(`[Migration] Removed ${deletedCount} inquiries from closed rooms`); | ||
|
||
// Queued inquiries pointing to a room thats served | ||
const openAndServedRooms = await LivechatRooms.find({ servedBy: { $exists: true } }, { projection: { _id: 1 } }).toArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again will take a long time. While servedBy does exist as index too with a lot of records this still takes a long time when has a lot of records
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will take a really long time to get responses from mongo on these queries for large omnichannel use cases
Yep, that's a known thing, as i said over there, that's why this is still a draft 👀 |
Closing as no longer needed |
https://rocketchat.atlassian.net/browse/CORE-238
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Migration will do 3 steps:
Since at the time a room is closed the inquiry is removed, we'll assume rooms that are already closed have all the data they require set, so we're only removing the inquiry to fix the status and unblock processing.
Queue will do the same steps for each of the inquiries it touches. Generally speaking, unless someone updates directly to this version or has been using manual selection all the time, this migration will do nothing.
[Merge when 7.0 is happening]