mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-25 10:33:47 +03:00
Fix time between batches count
This commit is contained in:
parent
36123db73e
commit
13b67ed77a
|
@ -231,7 +231,7 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)):
|
|||
if last_sync_time is None:
|
||||
return True
|
||||
|
||||
return (last_sync_time - datetime.datetime.now()).total_seconds() >= cls.get_sync_delay()
|
||||
return (datetime.datetime.now() - last_sync_time).total_seconds() >= cls.get_sync_delay()
|
||||
|
||||
|
||||
class ClickHouseMultiModel(ClickHouseModel):
|
||||
|
|
|
@ -26,5 +26,5 @@ class ClickHouseModelTest(TestCase):
|
|||
# Time has passed
|
||||
sync_delay = ClickHouseTestModel.get_sync_delay()
|
||||
self.storage.set_last_sync_time(ClickHouseTestModel.get_import_key(),
|
||||
datetime.datetime.now() - datetime.timedelta(seconds=sync_delay))
|
||||
self.assertFalse(ClickHouseTestModel.need_sync())
|
||||
datetime.datetime.now() - datetime.timedelta(seconds=sync_delay + 1))
|
||||
self.assertTrue(ClickHouseTestModel.need_sync())
|
||||
|
|
Loading…
Reference in New Issue
Block a user