feat(celery): set msgpack as default serializer and drop json_ext as it's actually slower

This commit is contained in:
RhodeCode Admin 2024-02-13 10:52:10 +01:00
parent 0f1af561b6
commit 296df48136

View file

@ -40,7 +40,6 @@ from celery import Celery
from celery import signals
from celery import Task
from celery import exceptions # noqa
from kombu.serialization import register
import rhodecode
@ -51,11 +50,6 @@ from rhodecode.lib.pyramid_utils import bootstrap, setup_logging
from rhodecode.lib.utils2 import str2bool
from rhodecode.model import meta
register('json_ext', json.dumps, json.loads,
content_type='application/x-json-ext',
content_encoding='utf-8')
log = logging.getLogger('celery.rhodecode.loader')
@ -75,9 +69,10 @@ base_celery_config = {
'result_persistent': True,
'imports': imports,
'worker_max_tasks_per_child': 20,
'accept_content': ['json_ext', 'json'],
'task_serializer': 'json_ext',
'result_serializer': 'json_ext',
'task_serializer': 'msgpack',
'accept_content': ['json', 'msgpack'],
'result_serializer': 'msgpack',
'result_accept_content': ['json', 'msgpack'],
'worker_hijack_root_logger': False,
'broker_connection_retry_on_startup': True,
'database_table_names': {