Fix max thread to 10 because au pool size
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
SebClem 2023-11-02 21:42:14 +01:00
parent bc5683cd72
commit 703feb8ca3

View File

@ -9,6 +9,8 @@ import pixivpy3
cpu_count = os.cpu_count() cpu_count = os.cpu_count()
max_thread_num = cpu_count * 2 if cpu_count is not None else 4 max_thread_num = cpu_count * 2 if cpu_count is not None else 4
if max_thread_num > 10:
max_thread_num = 10
def dowload_pixiv_images( def dowload_pixiv_images(
@ -22,6 +24,7 @@ def dowload_pixiv_images(
json_result = api.illust_detail(illust_id) json_result = api.illust_detail(illust_id)
illust = json_result.illust illust = json_result.illust
if not illust["visible"]: if not illust["visible"]:
logging.info("Can't be viewed, return None")
return None return None
pages = illust["meta_pages"] pages = illust["meta_pages"]
if len(pages) > 0: if len(pages) > 0: