Skip to content

Commit 805ec5f

Browse files
committedJan 31, 2019
manage.py: Revert sabotaging pika.adapters.twisted_connection import.
This reverts commit ec9f670. Now that pika 0.13.0 has merged our PR to not import twisted unless it is needed, we don't need to use this performance hack in order to avoid wasting time importing twisted and all its dependencies.
1 parent 0d00077 commit 805ec5f

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed
 

‎manage.py

-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from __future__ import (print_function)
33
import os
44
import sys
5-
import types
65
import configparser
76
if sys.version_info <= (3, 0):
87
print("Error: Zulip is a Python 3 project, and cannot be run with Python 2.")
@@ -32,15 +31,6 @@
3231
print("Error accessing Zulip secrets; manage.py in production must be run as the zulip user.")
3332
sys.exit(1)
3433

35-
# Performance Hack: We make the pika.adapters.twisted_connection
36-
# module unavailable, to save ~100ms of import time for most Zulip
37-
# management commands for code we don't use. The correct
38-
# long-term fix for this will be to get a setting integrated
39-
# upstream to disable pika importing this.
40-
# See https://github.com/pika/pika/issues/1128
41-
sys.modules['pika.adapters.twisted_connection'] = types.ModuleType(
42-
'pika.adapters.twisted_connection')
43-
4434
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
4535
from django.conf import settings
4636
from django.core.management import execute_from_command_line

‎zproject/wsgi.py

-10
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,11 @@
1515
"""
1616
import os
1717
import sys
18-
import types
1918

2019
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
2120
sys.path.append(BASE_DIR)
2221
import scripts.lib.setup_path_on_import
2322

24-
# Performance Hack: We make the pika.adapters.twisted_connection
25-
# module unavailable, to save ~100ms of import time for most Zulip
26-
# management commands for code we don't use. The correct
27-
# long-term fix for this will be to get a setting integrated
28-
# upstream to disable pika importing this.
29-
# See https://github.com/pika/pika/issues/1128
30-
sys.modules['pika.adapters.twisted_connection'] = types.ModuleType(
31-
'pika.adapters.twisted_connection')
32-
3323
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
3424
import django
3525
django.setup() # We need to call setup to load applications.

0 commit comments

Comments
 (0)