feat: send_apikey_usage_emails_task() #7486
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another that needs its
PeriodicTasks
created withietf/manage.py periodic_tasks --create-default
and enabled through the admin after deployment.I've put the new task in
ietf.person.tasks
, though I've kept its test in place inietf.ietfauth.tests
rather than move it. It's not clear to me where this task really belongs, but I've gone with person because that's where the models live.Some further refactoring is possible. For one, the test could be better split between testing the
ietfauth
views and specifically testing that this sends email for the correct events. Second, it's probably possible to cut down the number of queries as this first queries the keys, then one-by-one queries their events. I explored this a bit but it wasn't converging very well, and this is not a frequently-run task, so the potential payoff is probably minimal.This will have some merge conflicts with #7485 but they should be trivial.