-
Notifications
You must be signed in to change notification settings - Fork 85
enable mw api emailuser backend #1498
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: master
Are you sure you want to change the base?
Conversation
f685cf3 to
0201ab9
Compare
065941a to
c086792
Compare
c086792 to
e6fd993
Compare
e6fd993 to
1608291
Compare
1608291 to
1bc7bb9
Compare
1bc7bb9 to
a61018e
Compare
937980a to
66d0f18
Compare
b0b158c to
289f1a1
Compare
289f1a1 to
6ffba2d
Compare
6093334 to
db3da2c
Compare
db3da2c to
fb947bd
Compare
katydidnot
left a comment
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.
I was unable to confirm the email address in my local mediawiki environment to test the API, any tips?
I recommend setting up mail handling for mediawiki |
5efc66a to
178b9db
Compare
suecarmol
left a comment
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.
Made a first pass of the code and everything looks good. I left some questions that might need to be addressed in this PR.
The command python manage.py survey_active_users 000001 en fr de ja ru es --backend djmail.backends.default.EmailBackend --batch_size 10 seemed to hang in my local environment, but python manage.py survey_active_users 000001 en fr de ja ru es --backend djmail.backends.default.EmailBackend --batch_size 10 --staff_test seems to be working fine.
- Validate language codes in command
- Remove signal handling and clean up email sending code
- Fix issues in custom model manger
- Fix duplicate email check:
- stop using survey_email_sent userprofile field
- actually dropping the field should be handled later
- Now searches for existing messages based on translated subject and recipient
- Skips sending if message (of any status) exists
- Outputs some basic statistics
- Updated tests to reflect the new approach
- better naming for maxlag handling method in backend
Bug: T409420
Bug: T409420
178b9db to
cbeb003
Compare
I changed the strategy for checking for existing emails; before I was searching based on the user profile language, but realized that we would miss messages if the user changed their language preference. What I didn't do was reload a prod-sized user set and retest. It didn't hang on my machine, but it did take a really, really long time. The staff test works against a much smaller subset of users. I'll just switch back to the original strategy, which runs much faster, and should only result in a few possible edge cases of duplicate emails. |
- dramatic speedup - more informative log messages during execution Bug: T409420
I benchmarked several approaches with a large number of users and we now have the best of both worlds; the user query now happens quickly and we still search for all current translations of the subject line. |
Bug: T412427
|
|
||
| # All Wikipedia Library users who: | ||
| for user in ( | ||
| users = ( |
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.
@suecarmol @DHardy-WMF @katydidnot I added in support for the qualification exemptions: I did some checks and found that they had a small impact on the recipient count. Should make testing a little easier!
| return wrapper | ||
|
|
||
|
|
||
| def _handle_maxlag(response): |
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.
@DHardy-WMF if you have a local db setup that supports maxlag, I'd appreciate at least some minimal manual testing on this. This function is completely untested.
provides features required for mass emailing for survey mediawiki API.
Rationale
In T412427, we found that we were unable to send high volume mail via WMF cloud VPS SMTP infrastructure. So, we're going to try using mediawiki instead.
Phabricator Ticket
https://phabricator.wikimedia.org/T409420
How Has This Been Tested?
You can test run the command logic and djmail message tracking by passing through the default djmail backend (which should be console email for local dev).
For example:
python manage.py survey_active_users 000001 en fr de ja ru es --backend djmail.backends.default.EmailBackend --batch_size 10You may omit the backend to send it through the api, but in mediawiki you'll need to add and confirm email addresses for users with wp_usernames that match users in your TWLight. If you setup something like mailhog in mediawiki to handle mail delivery, you'll be able to see the survey messages accumulate there. It's kind of a pain.
Screenshots of your changes (if appropriate):
N/A
Types of changes
What types of changes does your code introduce? Add an
xin all the boxes that apply: