mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
send_event: Remove useless return value and annotate.
Detected by mypy. [tweaked by tabbott to pass mypy check and remove annotations]
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from typing import Any
|
from typing import Any, Dict, Iterable, Union
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -760,9 +760,14 @@ def send_notification_http(data):
|
|||||||
process_notification(data)
|
process_notification(data)
|
||||||
|
|
||||||
def send_notification(data):
|
def send_notification(data):
|
||||||
return queue_json_publish("notify_tornado", data, send_notification_http)
|
# type: (Dict[str, Any]) -> None
|
||||||
|
queue_json_publish("notify_tornado", data, send_notification_http)
|
||||||
|
|
||||||
def send_event(event, users):
|
def send_event(event, users):
|
||||||
return queue_json_publish("notify_tornado",
|
# type: (Dict[str, Any], Union[Iterable[int], Iterable[Dict[str, Any]]]) -> None
|
||||||
dict(event=event, users=users),
|
"""`users` is a list of user IDs, or in the case of `message` type
|
||||||
send_notification_http)
|
events, a list of dicts describing the users and metadata about
|
||||||
|
the user/message pair."""
|
||||||
|
queue_json_publish("notify_tornado",
|
||||||
|
dict(event=event, users=users),
|
||||||
|
send_notification_http)
|
||||||
|
|||||||
@@ -94,12 +94,12 @@ class SimpleQueueClient(object):
|
|||||||
|
|
||||||
def json_publish(self, queue_name, body):
|
def json_publish(self, queue_name, body):
|
||||||
try:
|
try:
|
||||||
return self.publish(queue_name, ujson.dumps(body))
|
self.publish(queue_name, ujson.dumps(body))
|
||||||
except (AttributeError, pika.exceptions.AMQPConnectionError):
|
except (AttributeError, pika.exceptions.AMQPConnectionError):
|
||||||
self.log.warning("Failed to send to rabbitmq, trying to reconnect and send again")
|
self.log.warning("Failed to send to rabbitmq, trying to reconnect and send again")
|
||||||
self._reconnect()
|
self._reconnect()
|
||||||
|
|
||||||
return self.publish(queue_name, ujson.dumps(body))
|
self.publish(queue_name, ujson.dumps(body))
|
||||||
|
|
||||||
def register_consumer(self, queue_name, consumer):
|
def register_consumer(self, queue_name, consumer):
|
||||||
def wrapped_consumer(ch, method, properties, body):
|
def wrapped_consumer(ch, method, properties, body):
|
||||||
|
|||||||
Reference in New Issue
Block a user