-
Notifications
You must be signed in to change notification settings - Fork 7
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
Handle notifications with large number of tickets and use docker compose
syntax
#77
Conversation
A regular find/sort query can exceed the memory limit of MongoDB if there are a large number of tickets included in a notification.
Now that we are not using a regular find/sort query, our result set no longer contains TicketDocs, hence these changes.
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.
allowDiskUse=Booosh!
Fine work @dav3r 💯
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.
Powerful work as always, @dav3r.
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.
🕵️♂️
The "docker compose" syntax is the preferred (and only correct) syntax after the changes in cisagov/ansible-role-docker#60.
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.
Approval intensifies
docker compose
syntax
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.
- Changes are limited to a single goal - eschew scope creep!
🤣
💪
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.
🐳
🗣 Description
This PR resolves a situation where a Mongo query can run out of memory and fail if a notification contains a large number of tickets.
In addition, 5485ed9 updates
create_send_notifications.py
to use the newerdocker compose
syntax instead of the older styledocker-compose
syntax. Thedocker compose
syntax is the preferred (and only correct) syntax after the changes in cisagov/ansible-role-docker#60.💭 Motivation and context
After our recent switch to CVSS v3 (see cisagov/cyhy-core#69 and #76), our daily notification process failed because one of the organizations had a very large number of tickets to process for their notification. The process failed with this error:
I first attempted to fix this by adding a new index to support this sort, but I was unable to get the sort to use that index. So instead, I worked around this issue by switching to a Mongo
aggregate
query, which allowed me to use theallowDiskUse
option to circumvent the memory limitation.🧪 Testing
To test these changes, I first verified that I could manually create a notification for the organization that failed with the memory error, and that was successful. I then created a fresh notification for an org that had previously (this morning) successfully generated a notification, and I compared those two docs to ensure that they were identical (they were).
Finally, I executed the entire daily notification process, which ran without any errors.
✅ Pre-approval checklist