mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
Import tornado ioloop directly instead of passing it from runtornado
(imported from commit ce901d7daca81bb1682827175bdcd83d3e5c2344)
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from tornado.ioloop import PeriodicCallback
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
@@ -11,6 +10,7 @@ import cPickle as pickle
|
|||||||
import atexit
|
import atexit
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
|
import tornado
|
||||||
|
|
||||||
IDLE_EVENT_QUEUE_TIMEOUT_SECS = 60 * 10
|
IDLE_EVENT_QUEUE_TIMEOUT_SECS = 60 * 10
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ def send_restart_events():
|
|||||||
# All clients get restart events
|
# All clients get restart events
|
||||||
client.add_event(event.copy())
|
client.add_event(event.copy())
|
||||||
|
|
||||||
def setup_event_queue(io_loop):
|
def setup_event_queue():
|
||||||
load_event_queues()
|
load_event_queues()
|
||||||
atexit.register(dump_event_queues)
|
atexit.register(dump_event_queues)
|
||||||
# Make sure we dump event queues even if we exit via signal
|
# Make sure we dump event queues even if we exit via signal
|
||||||
@@ -174,7 +174,9 @@ def setup_event_queue(io_loop):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Set up event queue garbage collection
|
# Set up event queue garbage collection
|
||||||
pc = PeriodicCallback(gc_event_queues, EVENT_QUEUE_GC_FREQ_MSECS, io_loop)
|
ioloop = tornado.ioloop.IOLoop.instance()
|
||||||
|
pc = tornado.ioloop.PeriodicCallback(gc_event_queues,
|
||||||
|
EVENT_QUEUE_GC_FREQ_MSECS, ioloop)
|
||||||
pc.start()
|
pc.start()
|
||||||
|
|
||||||
send_restart_events()
|
send_restart_events()
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Command(BaseCommand):
|
|||||||
if django.conf.settings.DEBUG:
|
if django.conf.settings.DEBUG:
|
||||||
ioloop.IOLoop.instance().set_blocking_log_threshold(5)
|
ioloop.IOLoop.instance().set_blocking_log_threshold(5)
|
||||||
|
|
||||||
setup_event_queue(ioloop.IOLoop.instance())
|
setup_event_queue()
|
||||||
ioloop.IOLoop.instance().start()
|
ioloop.IOLoop.instance().start()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user