Skip to content

Commit

Permalink
feat(app): add timeout; fix ai extent not counted for es
Browse files Browse the repository at this point in the history
  • Loading branch information
MorvanZhou committed Sep 19, 2024
1 parent 004b37b commit d1ec6f4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/retk/core/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def post(
if from_nid != "":
from_nids.append(from_nid)
res = await db_ops.node_add_to_set(from_nid, "toNodeIds", nid)
if res.modified_count != 1:
if not res.acknowledged:
return None, const.CodeEnum.OPERATION_FAILED

new_to_node_ids = []
Expand Down
3 changes: 2 additions & 1 deletion src/retk/core/utils/cos.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async def async_put(self, file: BinaryIO, uid: str, filename: str) -> bool:
url=f"https://{self.domain}/{key}",
headers=self.get_auth_headers("put", key),
content=file.read(),
timeout=60,
)
if resp.status_code != 200:
logger.error(f"put_cos_object | error: {resp.text}")
Expand All @@ -117,7 +118,7 @@ async def async_put(self, file: BinaryIO, uid: str, filename: str) -> bool:
httpx.ReadTimeout,
httpx.HTTPError
) as e:
logger.error(f"put_cos_object | error: {e}")
logger.error(f"put_cos_object | error: {str(e)}")
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion src/retk/models/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async def try_restore_search(self):
return
logger.critical(
f"restore search index count: {count_search}, mongo count: {count_mongo}."
f" They are not equal, tring to restore search index")
f" They are not equal, trying to restore search index")

await self.search.drop()
await self.search.init()
Expand Down

0 comments on commit d1ec6f4

Please sign in to comment.