-
Notifications
You must be signed in to change notification settings - Fork 197
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 sensei email generating multiple queries on page load #6819
Fix sensei email generating multiple queries on page load #6819
Conversation
Codecov Report
@@ Coverage Diff @@
## trunk #6819 +/- ##
============================================
- Coverage 49.80% 49.76% -0.04%
- Complexity 10650 10653 +3
============================================
Files 586 586
Lines 45047 45055 +8
Branches 402 402
============================================
- Hits 22434 22420 -14
- Misses 22286 22308 +22
Partials 327 327
Continue to review full report in Codecov by Sentry.
|
Hi @Imran92! Thanks for picking up this issue. This is an improvement, but I wonder if there is a way to still limit the meta queries... I'm still seeing ~38 related to this (without object caching). One way might be caching this, but then you'd need to handle invalidation. Did y'all consider delaying the check if an email was active until later on? One possibility would be a proxy callback in the hooks in the email generators' |
Thanks a lot for the review @jom! I've updated the PR to use a intermediate callback in the middle. Checking at the time of |
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.
Seems to work! 👍🏻
This one is pending a fix. @Imran92 would you mind describing what's left to do for this one so that it's not lost? Thx! |
Suppose someone has both sensei and sensei-pro and updates only sensei but not sensei pro or delays updating, as the check for being active has been moved from core to individual email generator. In that case, their pro emails will still be active even when deactivated during that time frame. We need to put a check in place to prevent that from happening. |
includes/internal/emails/generators/class-email-generators-abstract.php
Outdated
Show resolved
Hide resolved
Both of the issues mentioned #6819 (comment) and #6819 (comment) are taken care of in d9722c2 and 083af2d :) |
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.
Yeah, I believe it's the one that fetches the emails to populate the list we see when we're on Sensei LMS -> Settings -> Emails -> Student Emails. When we're on any other page, it shouldn't generate any query |
Resolves #6815
Proposed Changes
Testing Instructions
###Before
Screen.Recording.2023-04-18.at.2.59.54.PM.mov
###After
Pre-Merge Checklist