Improve API performance

pull/569/head
zanllp 2024-03-30 03:32:42 +08:00
parent e5853a6123
commit 2fb7cf407b
1 changed files with 6 additions and 1 deletions

View File

@ -582,8 +582,13 @@ def infinite_image_browsing_api(app: FastAPI, **kwargs):
@app.post(api_base + "/image_geninfo_batch", dependencies=[Depends(verify_secret)])
async def image_geninfo_batch(req: GeninfoBatchReq):
res = {}
conn = DataBase.get_conn()
for path in req.paths:
res[path] = await image_geninfo(path)
img = DbImg.get(conn, path)
if img:
res[path] = img.exif
else:
res[path] = await image_geninfo(path)
return res