From 6e4a5d7723beba38170836d9cf99b6e26669d8e6 Mon Sep 17 00:00:00 2001 From: M1ha Date: Mon, 19 Nov 2018 16:58:53 +0500 Subject: [PATCH] =?UTF-8?q?1)=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=87=D0=B5=D1=82=D1=87=D0=B8=D0=BA=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=B1=D0=B0=D0=B3=D0=B5=20https://carrot.atlass?= =?UTF-8?q?ian.net/browse/RED-5318=202)=20=D0=A4=D0=B8=D0=BA=D1=81=D1=8B?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D1=82=D0=B5=D1=81=D1=82=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/django_clickhouse/tasks.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/django_clickhouse/tasks.py b/src/django_clickhouse/tasks.py index cce3099..2aeeef2 100644 --- a/src/django_clickhouse/tasks.py +++ b/src/django_clickhouse/tasks.py @@ -9,30 +9,28 @@ from .utils import get_subclasses @shared_task(queue=config.CELERY_QUEUE) -def sync_clickhouse_converter(cls): +def sync_clickhouse_converter(cls): # type: (ClickHouseModel) -> None """ Syncs one batch of given ClickHouseModel - :param cls: Наследник ClickHouseModelConverter - :return: Количество загруженных в ClickHouse записей + :param cls: ClickHouseModel subclass + :return: None """ statsd_key = "%s.sync.%s.time" % (config.STATSD_PREFIX, cls.__name__) with statsd.timing(statsd_key): - result = cls.sync_batch_from_storage() - - return result + cls.sync_batch_from_storage() @shared_task(queue=config.CELERY_QUEUE) def clickhouse_auto_sync(): """ Plans syncing models - :return: + :return: None """ # Import all model modules for app in settings.INSTALLED_APPS: import_submodules("%s.%s" % (app, config.MODELS_MODULE)) - # Запускаем + # Start for cls in get_subclasses(ClickHouseModel, recursive=True): if cls.start_sync(): # Даже если синхронизация вдруг не выполнится, не страшно, что мы установили период синхронизации