From 0b658dee8867a9a077f24e7b95a0409e0125b697 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Thu, 19 Sep 2024 14:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20embedding=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cucyuqing/cmd/embedding.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cucyuqing/cmd/embedding.py b/cucyuqing/cmd/embedding.py index 46fd414..3fdd1e6 100644 --- a/cucyuqing/cmd/embedding.py +++ b/cucyuqing/cmd/embedding.py @@ -1,5 +1,7 @@ +import traceback import datetime import asyncio +from sqlalchemy.sql.ddl import exc import tqdm import os from tokenizers import Tokenizer @@ -164,8 +166,12 @@ async def get_embedding_from_cache(hash: str) -> list[float] | None: async def main(): await pool.open() while True: - await do_update() - await asyncio.sleep(60) + try: + await do_update() + except Exception as e: + print(traceback.format_exc()) + finally: + await asyncio.sleep(60) async def do_update(): while True: