mirror of
				https://github.com/carrotquest/django-clickhouse.git
				synced 2025-11-04 09:57:42 +03:00 
			
		
		
		
	Removed deprecated comment
This commit is contained in:
		
							parent
							
								
									6e0bc424d7
								
							
						
					
					
						commit
						a37cd25453
					
				| 
						 | 
					@ -185,42 +185,3 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)):
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return (last_sync_time - datetime.datetime.now()).total_seconds() >= cls.get_sync_delay()
 | 
					        return (last_sync_time - datetime.datetime.now()).total_seconds() >= cls.get_sync_delay()
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# class ClickHouseModelConverter:
 | 
					 | 
				
			||||||
#     """
 | 
					 | 
				
			||||||
#     Абстрактный класс, описывающий процесс конвертации модели django в модель ClickHouse и обратно.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#     @classmethod
 | 
					 | 
				
			||||||
#     def start_sync(cls):
 | 
					 | 
				
			||||||
#         """
 | 
					 | 
				
			||||||
#         Проверяет, нужна ли модели синхронизация.
 | 
					 | 
				
			||||||
#         Если синхронизация нужна, отмечает, что синхронизация началась.
 | 
					 | 
				
			||||||
#         :return: Boolean, надо ли начинать синхронизацию
 | 
					 | 
				
			||||||
#         """
 | 
					 | 
				
			||||||
#         if cls.auto_sync is None:
 | 
					 | 
				
			||||||
#             return False
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#         assert type(cls.auto_sync) is int and cls.auto_sync > 0, \
 | 
					 | 
				
			||||||
#             "auto_sync attribute must be positive integer if given"
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#         # Получаем результаты предыдущей синхронизации
 | 
					 | 
				
			||||||
#         redis_dict_key = "{0}:{1}".format(cls.__module__, cls.__name__)
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#         now_ts = int(now().timestamp())
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#         # Сразу же делаем вид, что обновление выполнено.
 | 
					 | 
				
			||||||
#         # Если другой поток зайдет сюда, он увидит, что обновление уже выполнено
 | 
					 | 
				
			||||||
#         # В конце, если обновление не выполнялось, вернем старое значение
 | 
					 | 
				
			||||||
#         previous = settings.REDIS.pipeline().hget(ClickHouseModelConverter.REDIS_SYNC_KEY, redis_dict_key). \
 | 
					 | 
				
			||||||
#             hset(ClickHouseModelConverter.REDIS_SYNC_KEY, redis_dict_key, now_ts).execute()[0]
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#         previous = int(previous) if previous else 0
 | 
					 | 
				
			||||||
#         result = bool(previous + cls.auto_sync < now_ts)
 | 
					 | 
				
			||||||
#         if not result:
 | 
					 | 
				
			||||||
#             # Возвращаем старое значение флагу, который мы изменили выше
 | 
					 | 
				
			||||||
#             settings.REDIS.hset(ClickHouseModelConverter.REDIS_SYNC_KEY, redis_dict_key, previous)
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#         return result
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user