Skip to content

Commit

Permalink
Reconnect to database when the connection fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed Dec 9, 2016
1 parent ea4ec93 commit e968f18
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tutormail/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ def translate_recipient(self, rcptto):

def get_groups(self, recipient):
"""Get all TutorGroups that an alias refers to."""
group_names = resolve_alias(recipient)
try:
group_names = resolve_alias(recipient)
except Exception:
# https://code.djangoproject.com/ticket/21597#comment:29
from django.db import connection
connection.close()
group_names = resolve_alias(recipient)
groups = []
for name in group_names:
group_and_year = self.get_group(name)
Expand Down

0 comments on commit e968f18

Please sign in to comment.