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"])}' )