-
Notifications
You must be signed in to change notification settings - Fork 1
Performance Analysis: Document codebase performance issues with prioritized recommendations #211
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Charl1996 <[email protected]>
Co-authored-by: Charl1996 <[email protected]>
| ```python | ||
| for channel in channels: | ||
| # ... | ||
| channel_messages = Message.objects.filter( # Separate query for each channel! |
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 number of channels is not much so this is probably not that important
|
|
||
| # Send one aggregated notification per user | ||
| for username, messages in user_messages.items(): | ||
| # Send summary notification instead of individual ones |
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 is suggesting a change in feature behaviour, so can't implement this
|
|
||
| **Impact:** For bulk notifications to N users, this results in N+1 database queries instead of 2 optimized queries. | ||
|
|
||
| **Recommendation:** |
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.
Added in #215
| ```python | ||
| def get(self, request, *args, **kwargs): | ||
| user = request.user | ||
| channels = Channel.objects.filter(connect_user=user).select_related("server") |
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.
Added in #215
Technical Summary
Comprehensive analysis of the Connect-ID codebase identifying 14 performance issues, organized by priority with actionable fixes.
High Priority (5 issues):
send_bulk_notification(),RetrieveMessageView,RetrieveNotificationViewresend_notifications_for_undelivered_messages()Medium Priority (5 issues):
ConnectUser.phone_number+is_active,Message.received+direction,Notification.receivedAddCredentialLow Priority (4 issues):
ORDER BYExample N+1 pattern identified:
Added
PERFORMANCE.mdwith detailed analysis, code samples, and priority matrix.Logging and monitoring
N/A - documentation only.
Safety Assurance
Safety story
Documentation-only change; no code modifications
All 207 existing tests pass
I am confident that this change will not break current and/or previous versions of CommCare apps
Automated test coverage
N/A - no code changes.
QA Plan
N/A - documentation only.
Labels & Review
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sutton-henson.com/usr/bin/python python -m pytest --tb=short -q(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.