Skip to content

Commit

Permalink
E-mailverzending oneindige timeout #1310
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Mar 7, 2021
1 parent 7307c9b commit 4d53b8d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ v4.13.0 - 2021-xx-xx

- ``Fixed``: Schoonheidsfoutje op de statistieken pagina [`#1305 <https://github.com/dsmrreader/dsmr-reader/issues/1305>`_]
- ``Fixed``: Bestaande superusers uitschakelen bij uitvoeren "dsmr_superuser" command [`#1309 <https://github.com/dsmrreader/dsmr-reader/issues/1309>`_]
- ``Fixed``: E-mailverzending timeout [`#1310 <https://github.com/dsmrreader/dsmr-reader/issues/1310>`_]


v4.12.0 - 2021-02-17
Expand Down
4 changes: 3 additions & 1 deletion dsmr_backend/services/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def send(email_from, email_to, subject, body, attachment=None):
use_ssl=email_settings.use_ssl
)

# Force translations.
# Prevent hanging processes, ensure there is always a timeout set.
assert email_backend.timeout is not None

message = mail.EmailMessage(
subject=subject,
body=body,
Expand Down
6 changes: 4 additions & 2 deletions dsmr_backend/tests/services/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def test_send_email(self, attach_file_mock, send_mock):
email_from='root@localhost',
email_to='root@localhost',
subject='Test',
body='Body')
body='Body'
)

self.assertTrue(send_mock.called)
self.assertFalse(attach_file_mock.called)
Expand All @@ -36,7 +37,8 @@ def test_send_email_with_attachment(self, attach_file_mock, send_mock):
email_to='root@localhost',
subject='Test',
body='Body',
attachment='/tmp/test')
attachment='/tmp/test'
)

self.assertTrue(send_mock.called)
self.assertTrue(attach_file_mock.called)
2 changes: 1 addition & 1 deletion dsmrreader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.version import get_version

VERSION = (4, 13, 0, 'beta', 6)
VERSION = (4, 13, 0, 'beta', 7)

__version__ = get_version(VERSION)
1 change: 1 addition & 0 deletions dsmrreader/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@

LOCALE_PATHS = (os.path.join(BASE_DIR, 'locales'), )

EMAIL_TIMEOUT = 30

""" Python Logging. """
LOGGING = {
Expand Down
Binary file modified dsmrreader/locales/nl/LC_MESSAGES/django.mo
Binary file not shown.

0 comments on commit 4d53b8d

Please sign in to comment.