From 809dc883c88fbf79c54f764af646079c650fd972 Mon Sep 17 00:00:00 2001 From: Changhua Date: Mon, 10 Mar 2025 23:10:44 +0800 Subject: [PATCH] fix(python): sleep 1s to make sure data has been stored into db --- clients/python/wcferry/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clients/python/wcferry/client.py b/clients/python/wcferry/client.py index e015d77..a9d99c0 100644 --- a/clients/python/wcferry/client.py +++ b/clients/python/wcferry/client.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -__version__ = "39.4.2.1" +__version__ = "39.4.2.2" import atexit import base64 @@ -845,7 +845,8 @@ class Wcf(): Returns: str: 成功返回存储路径;空字符串为失败,原因见日志。 """ - if self.download_attach(id, "", extra) != 0: + sleep(1) # 强制等待 1 秒让数据入库,避免那帮人总是嗷嗷叫超时 + if (not os.path.exists(extra)) and (self.download_attach(id, "", extra) != 0): self.LOG.error(f"下载失败") return "" cnt = 0 @@ -871,6 +872,7 @@ class Wcf(): Returns: str: 成功返回存储路径;空字符串为失败,原因见日志。 """ + sleep(1) # 强制等待 1 秒让数据入库,避免那帮人总是嗷嗷叫超时 base, _ = os.path.splitext(thumb) file_path = base + ".mp4" file_name = os.path.basename(file_path)