forked from zulip/zulip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
missed-emails-sending: Move email sending to separate queue worker.
- Add new 'missedmessage_email_senders' queue for sending missed messages emails. - Add the new worker to process 'missedmessage_email_senders' queue. - Split aggregation missed messages and sending missed messages email to separate queue workers. - Adapt tests for sending missed emails to the new logic. Fixes zulip#2607
- Loading branch information
Showing
8 changed files
with
53 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Tuple, TypeVar, Text | ||
from typing import (Any, Callable, Dict, Iterable, List, Mapping, | ||
Optional, Tuple, TypeVar, Text, Union) | ||
from mock import patch, MagicMock | ||
|
||
from django.http import HttpResponse | ||
|
@@ -23,7 +24,7 @@ | |
from zerver.models import UserProfile, Recipient, \ | ||
Realm, RealmAlias, UserActivity, \ | ||
get_user_profile_by_email, get_realm, get_client, get_stream, \ | ||
Message, get_unique_open_realm, completely_open | ||
Message, get_unique_open_realm, completely_open, get_context_for_message | ||
|
||
from zerver.lib.avatar import avatar_url | ||
from zerver.lib.initial_password import initial_password | ||
|
@@ -33,7 +34,8 @@ | |
do_change_is_admin, extract_recipients, \ | ||
do_set_realm_name, do_deactivate_realm, \ | ||
do_change_stream_invite_only | ||
from zerver.lib.notifications import handle_missedmessage_emails | ||
from zerver.lib.notifications import handle_missedmessage_emails, \ | ||
send_missedmessage_email | ||
from zerver.lib.session_user import get_session_dict_user | ||
from zerver.middleware import is_slow_query | ||
from zerver.lib.utils import split_by | ||
|
@@ -2330,9 +2332,8 @@ def _test_cases(self, tokens, msg_id, body, send_as_user): | |
othello = get_user_profile_by_email('[email protected]') | ||
hamlet = get_user_profile_by_email('[email protected]') | ||
handle_missedmessage_emails(hamlet.id, [{'message_id': msg_id}]) | ||
|
||
msg = mail.outbox[0] | ||
reply_to_addresses = [settings.EMAIL_GATEWAY_PATTERN % (u'mm' + t) for t in tokens] | ||
msg = mail.outbox[0] | ||
sender = 'Zulip <{}>'.format(settings.NOREPLY_EMAIL_ADDRESS) | ||
from_email = sender | ||
self.assertEqual(len(mail.outbox), 1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters