Update main.py

Co-authored-by: quqiOnfree <quqiOnfree@outlook.com>
This commit is contained in:
GiriNeko 2025-08-26 22:26:51 +08:00 committed by GitHub
parent 7eb0dba03a
commit 8857a0ca63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,7 +27,8 @@ async def get_icon_image(url: str):
def read_file(path): def read_file(path):
with open(path, "rb") as f: with open(path, "rb") as f:
return f.read() return f.read()
return await asyncio.to_thread(read_file, url) loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, read_file, url)
async def generate_java_status_image(addr: str): async def generate_java_status_image(addr: str):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()