﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24380	First locmem email sent in tests is absurdly slow.	Fletcher Tomalty	nobody	"Some of my application's tests send email. When running tests, Django sets `EMAIL_BACKEND` to be `django.core.mail.backends.locmem.EmailBackend`. This backend's `send_messages` calls `message.message()` on each email in order to do header validation. However, this has the side effect of generating a `Message-ID` email header, which calls `make_msgid()`, which ends up calling `socket.getfqdn()`. On my machine, `socket.getfqdn()` takes over 5 seconds to return. The `socket.getfqdn()` is cached, fortunately, so the 5 second delay only happens once.

Five seconds may seem small but it is really significant when you're rapidly alternating between writing code and running tests, and it's totally unnecessary to set a `Message-ID` header on emails in `django.core.mail.backends.locmem`. Right now my large test suite runs in 600 ms if I comment out that one pesky call that turns it into 5800 ms. So while this isn't a bug, I think fixing it would be a really nice quality-of-life change. "	Cleanup/optimization	closed	Core (Mail)	1.7	Normal	wontfix	email fqdn performance tests		Unreviewed	0	0	0	0	1	0
