From 780b13a42e7dd39f2ffc6e4af966226909c36bf1 Mon Sep 17 00:00:00 2001 From: M1ha Date: Tue, 22 Jan 2019 11:58:41 +0500 Subject: [PATCH] Optimization --- src/django_clickhouse/clickhouse_models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/django_clickhouse/clickhouse_models.py b/src/django_clickhouse/clickhouse_models.py index 3848973..ea61399 100644 --- a/src/django_clickhouse/clickhouse_models.py +++ b/src/django_clickhouse/clickhouse_models.py @@ -183,7 +183,8 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)): :return: """ if batch: - cls.get_database(for_write=True).insert(batch, batch_size=len(batch)) + # +10 constant is to avoid 0 insert, generated by infi + cls.get_database(for_write=True).insert(batch, batch_size=len(batch) + 10) @classmethod def sync_batch_from_storage(cls):