mirror of https://github.com/zulip/zulip.git
parent
1fcf2ff525
commit
3d1bcb05e1
|
@ -197,13 +197,13 @@ thread. It's also used for communication between the application server
|
|||
and the Tornado push system.
|
||||
|
||||
Two simple wrappers around `pika` (the Python RabbitMQ client) are in
|
||||
`zulip/server/lib/queue.py`. There's an asynchronous client for use in
|
||||
`zulip/zerver/lib/queue.py`. There's an asynchronous client for use in
|
||||
Tornado and a more general client for use elsewhere.
|
||||
|
||||
`zerver/lib/event_queue.py` has helper functions for putting events into
|
||||
one queue or another. Most of the processes started by Supervisor are
|
||||
queue processors that continually pull things out of a RabbitMQ queue
|
||||
and handle them.
|
||||
`zerver/tornado/event_queue.py` has helper functions for putting
|
||||
events into one queue or another. Most of the processes started by
|
||||
Supervisor are queue processors that continually pull things out of a
|
||||
RabbitMQ queue and handle them.
|
||||
|
||||
Also see [the queuing guide](queuing.html).
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ var DEFAULT_IDLE_TIMEOUT_MS = 5 * 60 * 1000;
|
|||
var ACTIVE_PING_INTERVAL_MS = 50 * 1000;
|
||||
|
||||
/* Mark users as offline after 140 seconds since their last checkin,
|
||||
* Keep in sync with zerver/lib/event_queue.py:receiver_is_idle
|
||||
* Keep in sync with zerver/tornado/event_queue.py:receiver_is_idle
|
||||
*/
|
||||
var OFFLINE_THRESHOLD_SECS = 140;
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ from zerver.lib.cache import cache_with_key, cache_set, \
|
|||
user_profile_by_email_cache_key, cache_set_many, \
|
||||
cache_delete, cache_delete_many
|
||||
from zerver.decorator import statsd_increment
|
||||
from zerver.lib.event_queue import request_event_queue, get_user_events, send_event
|
||||
from zerver.lib.utils import log_statsd_event, statsd
|
||||
from zerver.lib.html_diff import highlight_html_differences
|
||||
from zerver.lib.alert_words import user_alert_words, add_user_alert_words, \
|
||||
|
@ -83,6 +82,7 @@ from zerver.lib.session_user import get_session_user
|
|||
from zerver.lib.upload import attachment_url_re, attachment_url_to_path_id, \
|
||||
claim_attachment, delete_message_image
|
||||
from zerver.lib.str_utils import NonBinaryStr, force_str
|
||||
from zerver.tornado.event_queue import request_event_queue, get_user_events, send_event
|
||||
|
||||
import DNS
|
||||
import ujson
|
||||
|
|
|
@ -19,7 +19,6 @@ from zerver.lib.initial_password import initial_password
|
|||
from zerver.lib.db import TimeTrackingCursor
|
||||
from zerver.lib.str_utils import force_text
|
||||
from zerver.lib import cache
|
||||
from zerver.lib import event_queue
|
||||
from zerver.tornado.handlers import allocate_handler_id
|
||||
from zerver.worker import queue_processors
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from zerver.lib.initial_password import initial_password
|
|||
from zerver.lib.db import TimeTrackingCursor
|
||||
from zerver.lib.str_utils import force_text
|
||||
from zerver.lib import cache
|
||||
from zerver.lib import event_queue
|
||||
from zerver.tornado import event_queue
|
||||
from zerver.tornado.handlers import allocate_handler_id
|
||||
from zerver.worker import queue_processors
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ from tornado.log import app_log
|
|||
from typing import Callable
|
||||
|
||||
from zerver.lib.debug import interactive_debug_listen
|
||||
from zerver.lib.event_queue import process_notification, missedmessage_hook
|
||||
from zerver.lib.event_queue import setup_event_queue, add_client_gc_hook
|
||||
from zerver.lib.queue import setup_tornado_rabbitmq
|
||||
from zerver.tornado.application import create_tornado_application
|
||||
from zerver.tornado.event_queue import add_client_gc_hook, \
|
||||
missedmessage_hook, process_notification, setup_event_queue
|
||||
from zerver.tornado.socket import respond_send_message
|
||||
|
||||
import logging
|
||||
|
|
|
@ -51,7 +51,6 @@ from zerver.lib.actions import (
|
|||
get_subscription
|
||||
)
|
||||
|
||||
from zerver.lib.event_queue import allocate_client_descriptor
|
||||
from zerver.lib.message import render_markdown
|
||||
from zerver.lib.test_helpers import POSTRequestMock
|
||||
from zerver.lib.test_classes import (
|
||||
|
@ -64,6 +63,7 @@ from zerver.lib.validator import (
|
|||
|
||||
from zerver.views.events_register import _default_all_public_streams, _default_narrow
|
||||
|
||||
from zerver.tornado.event_queue import allocate_client_descriptor, EventQueue
|
||||
from zerver.tornado.views import get_events_backend
|
||||
|
||||
from collections import OrderedDict
|
||||
|
@ -923,7 +923,6 @@ class FetchInitialStateDataTest(ZulipTestCase):
|
|||
result = fetch_initial_state_data(user_profile, None, "")
|
||||
self.assertTrue(len(result['realm_bots']) > 5)
|
||||
|
||||
from zerver.lib.event_queue import EventQueue
|
||||
class EventQueueTest(TestCase):
|
||||
def test_one_event(self):
|
||||
# type: () -> None
|
||||
|
|
|
@ -17,7 +17,6 @@ from django.http import HttpRequest, HttpResponse
|
|||
from tornado.gen import Return
|
||||
from tornado.httpclient import HTTPRequest
|
||||
|
||||
from zerver.lib.event_queue import fetch_events
|
||||
from zerver.lib.test_helpers import POSTRequestMock
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
|
||||
|
@ -29,6 +28,7 @@ from tornado.web import Application
|
|||
from tornado.websocket import websocket_connect
|
||||
|
||||
from zerver.tornado.application import create_tornado_application
|
||||
from zerver.tornado.event_queue import fetch_events
|
||||
from zerver.tornado.views import get_events_backend
|
||||
|
||||
from six.moves.http_cookies import SimpleCookie
|
||||
|
|
|
@ -3,19 +3,19 @@ from __future__ import print_function
|
|||
|
||||
from typing import Any, Optional
|
||||
|
||||
if False: import zerver.lib.event_queue
|
||||
if False: import zerver.tornado.event_queue
|
||||
|
||||
descriptors_by_handler_id = {} # type: Dict[int, zerver.lib.event_queue.ClientDescriptor]
|
||||
descriptors_by_handler_id = {} # type: Dict[int, zerver.tornado.event_queue.ClientDescriptor]
|
||||
|
||||
def get_descriptor_by_handler_id(handler_id):
|
||||
# type: (int) -> zerver.lib.event_queue.ClientDescriptor
|
||||
# type: (int) -> zerver.tornado.event_queue.ClientDescriptor
|
||||
return descriptors_by_handler_id.get(handler_id)
|
||||
|
||||
def set_descriptor_by_handler_id(handler_id, client_descriptor):
|
||||
# type: (int, zerver.lib.event_queue.ClientDescriptor) -> None
|
||||
# type: (int, zerver.tornado.event_queue.ClientDescriptor) -> None
|
||||
descriptors_by_handler_id[handler_id] = client_descriptor
|
||||
|
||||
def clear_descriptor_by_handler_id(handler_id, client_descriptor):
|
||||
# type: (int, Optional[zerver.lib.event_queue.ClientDescriptor]) -> None
|
||||
# type: (int, Optional[zerver.tornado.event_queue.ClientDescriptor]) -> None
|
||||
del descriptors_by_handler_id[handler_id]
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ from zerver.lib.queue import queue_json_publish
|
|||
from zerver.lib.actions import check_send_message, extract_recipients
|
||||
from zerver.decorator import JsonableError
|
||||
from zerver.lib.utils import statsd
|
||||
from zerver.lib.event_queue import get_client_descriptor
|
||||
from zerver.middleware import record_request_start_data, record_request_stop_data, \
|
||||
record_request_restart_data, write_log_line, format_timedelta
|
||||
from zerver.lib.redis_utils import get_redis_client
|
||||
from zerver.lib.session_user import get_session_user
|
||||
from zerver.tornado.event_queue import get_client_descriptor
|
||||
|
||||
logger = logging.getLogger('zulip.socket')
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from zerver.decorator import asynchronous, \
|
|||
|
||||
from zerver.lib.response import json_success, json_error
|
||||
from zerver.lib.validator import check_bool, check_list, check_string
|
||||
from zerver.lib.event_queue import get_client_descriptor, \
|
||||
from zerver.tornado.event_queue import get_client_descriptor, \
|
||||
process_notification, fetch_events
|
||||
from django.core.handlers.base import BaseHandler
|
||||
|
||||
|
|
Loading…
Reference in New Issue