fix async bug in mailadress target event lookup
This commit is contained in:
parent
68812fe6b9
commit
fd7847993b
2 changed files with 66 additions and 12 deletions
|
@ -90,6 +90,15 @@ def find_active_issue_thread(in_reply_to, subject=None):
|
|||
return issue, True
|
||||
|
||||
|
||||
def find_target_event(address):
|
||||
try:
|
||||
address_map = EventAddress.objects.get(address=address)
|
||||
if address_map.event:
|
||||
return address_map.event
|
||||
except EventAddress.DoesNotExist:
|
||||
pass
|
||||
return None
|
||||
|
||||
class LMTPHandler:
|
||||
async def handle_RCPT(self, server, session, envelope, address, rcpt_options):
|
||||
from core.settings import MAIL_DOMAIN
|
||||
|
@ -142,13 +151,7 @@ class LMTPHandler:
|
|||
subject = parsed.get('Subject')
|
||||
subject = unescape_and_decode_quoted_printable(subject)
|
||||
subject = unescape_and_decode_base64(subject)
|
||||
target_event = None
|
||||
try:
|
||||
address_map = await sync_to_async(EventAddress.objects.get)(address=recipient)
|
||||
if address_map.event:
|
||||
target_event = address_map.event
|
||||
except EventAddress.DoesNotExist:
|
||||
pass
|
||||
target_event = await sync_to_async(find_target_event)(recipient)
|
||||
|
||||
active_issue_thread, new = await sync_to_async(find_active_issue_thread)(header_in_reply_to, subject)
|
||||
body_decoded = body.decode('utf-8')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue