Skip to content

Commit

Permalink
```优化异常处理,移除不必要的延迟
Browse files Browse the repository at this point in the history
优化SuyaDownloader的异常处理机制,移除初始化API字符串函数中的睡眠延迟。增加pass语句以清晰地标示异常流程。
```
  • Loading branch information
Suisuroru committed Sep 17, 2024
1 parent 8e65cf8 commit 27c0c3a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Suya_Downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,24 +1614,19 @@ def initialize_client_api():
if response_client.status_code == 200:
return
except:
sleep(1)
pass


def initialize_api_str():
"""初始化Suya API"""
global api_json_str
count_num = 0
while count_num < 3:
while True:
try:
api_json_str = requests.get(suya_config["Used_Server_url_get"]["latest_api_url"]).text.strip()
if response_client.status_code == 200:
return
else:
count_num += 1
sleep(1)
except:
count_num += 1
sleep(1)
pass


def initialize_api(selected_source, source_combobox, notice_text_area, strip_downloader, label_downloader, strip_client,
Expand Down

0 comments on commit 27c0c3a

Please sign in to comment.