Open nautics889 opened 4 years ago
The send_messages
method used in tasks.py is one of Django's built in one or a custom one someone else writes. It should not be CeleryEmailBackend.send_messages
because that's the one that has caused the task to be run. You make a good point that the send_messages
in the celery backend should probably return an integer like the Django docs suggest, but for now it doesn't so that users' code can check the results of the tasks if they need to.
I encountered a TypeError error during sending messages, because it tried to add an integer and a list in tasks.py. I have been searching for the reason and found a little inconsistency with what Django's documentation suggests:
So it looked like there was a problem in
CeleryEmailBackend.send_messages
in backends.py, but when i tried to fix that method and implement returning number of sent messages instead of a list with async results, several tests were failed as the result. Probably, it had had a side-effect for some other cases. So i decided to add a type checking in the tasks.py._Note: probably you may also want to look at
CeleryEmailBackend.send_messages
_