From dd41d6fa5f5fb930d707fad3a59afcde5c009c75 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Sat, 14 Sep 2024 17:19:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20es=20=E8=BF=94=E5=9B=9E=E7=A9=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cucyuqing/cmd/es-sync.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cucyuqing/cmd/es-sync.py b/cucyuqing/cmd/es-sync.py index f3b5a2a..b225e29 100644 --- a/cucyuqing/cmd/es-sync.py +++ b/cucyuqing/cmd/es-sync.py @@ -58,6 +58,9 @@ async def fetch(interval: ESInterval, size=1000) -> AsyncIterable[dict]: return docs = es_response["data"]["docs"] + if not docs: + print("未获取到数据") + return print( f'用时 {int(duration)} 秒,获取到 {len(docs)} 条数据,最早时间 {parse_unixtime(docs[0]["crawled_at"])},最晚时间 {parse_unixtime(docs[-1]["crawled_at"])}' )