mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 04:12:23 +01:00
5eb98ef624
* refactor: move event and person query to /posthog * move imports * another import * refactor: move actions * refactor: move actions * enterprise * trigger tests * test * make dummy
15 lines
531 B
Python
15 lines
531 B
Python
from time import sleep, time
|
|
|
|
from posthog.client import sync_execute
|
|
|
|
|
|
# this normally is unnecessary as CH is fast to consume from Kafka when testing
|
|
# but it helps prevent potential flakiness
|
|
def delay_until_clickhouse_consumes_from_kafka(table_name: str, target_row_count: int, timeout_seconds=10) -> None:
|
|
ts_start = time()
|
|
while time() < ts_start + timeout_seconds:
|
|
result = sync_execute(f"SELECT COUNT(1) FROM {table_name}")
|
|
if result[0][0] == target_row_count:
|
|
return
|
|
sleep(0.5)
|