mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-25 02:23:45 +03:00
Fix need_sync period
This commit is contained in:
parent
2d2ec9c055
commit
13a226501f
|
@ -273,7 +273,7 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)):
|
|||
:return: Boolean
|
||||
"""
|
||||
if not cls.sync_enabled:
|
||||
logger.debug('django-clickhouse: need_sync returned False for class %s as sync is deisabled' % cls.__name__)
|
||||
logger.debug('django-clickhouse: need_sync returned False for class %s as sync is disabled' % cls.__name__)
|
||||
return False
|
||||
|
||||
last_sync_time = cls.get_storage().get_last_sync_time(cls.get_import_key())
|
||||
|
@ -349,7 +349,6 @@ class ClickHouseMultiModel(ClickHouseModel):
|
|||
|
||||
with statsd.timer(statsd_key.format('steps.post_sync')):
|
||||
storage.post_sync(import_key)
|
||||
storage.set_last_sync_time(import_key, datetime.datetime.now())
|
||||
|
||||
except RedisLockTimeoutError:
|
||||
pass # skip this sync round if lock is acquired by another thread
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import datetime
|
||||
import importlib
|
||||
|
||||
from celery import shared_task
|
||||
from django.conf import settings
|
||||
from infi.clickhouse_orm.utils import import_submodules
|
||||
from statsd.defaults.django import statsd
|
||||
|
||||
from django_clickhouse.clickhouse_models import ClickHouseModel
|
||||
from .configuration import config
|
||||
|
@ -17,6 +17,7 @@ def sync_clickhouse_model(cls): # type: (ClickHouseModel) -> None
|
|||
:param cls: ClickHouseModel subclass
|
||||
:return: None
|
||||
"""
|
||||
cls.get_storage().set_last_sync_time(cls.get_import_key(), datetime.datetime.now())
|
||||
cls.sync_batch_from_storage()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user