Skip to content

Commit bccbaa7

Browse files
authored
Merge pull request #4834 from bjester/jit-setting
Add signal handler that runs postgres setting on connection created
2 parents f0f196d + 63f033c commit bccbaa7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

contentcuration/contentcuration/apps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ class ContentConfig(AppConfig):
88
name = 'contentcuration'
99

1010
def ready(self):
11+
# Import signals
12+
import contentcuration.signals # noqa
13+
1114
if settings.AWS_AUTO_CREATE_BUCKET and not is_gcs_backend():
1215
from contentcuration.utils.minio_utils import ensure_storage_bucket_public
1316
ensure_storage_bucket_public()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from django.db.backends.signals import connection_created
2+
from django.dispatch import receiver
3+
4+
5+
@receiver(connection_created)
6+
def set_jit(sender, connection, **kwargs):
7+
"""
8+
Disable Just-In-Time compilation for PostgreSQL databases, at least until we can
9+
optimize its use.
10+
https://www.postgresql.org/docs/12/runtime-config-query.html#GUC-JIT
11+
"""
12+
if connection.vendor == 'postgresql':
13+
with connection.cursor() as cursor:
14+
cursor.execute("SET jit = 'off';")

0 commit comments

Comments
 (0)