From c1574b4b3218f8c8b7080567e3de0f2f90b595bf Mon Sep 17 00:00:00 2001 From: Scobiform Date: Wed, 17 Apr 2024 19:28:27 +0200 Subject: [PATCH] #1 remove asyncio --- start.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/start.py b/start.py index 7fb95ef..452e851 100644 --- a/start.py +++ b/start.py @@ -1,4 +1,3 @@ -import asyncio import logging import os import subprocess @@ -40,18 +39,19 @@ async def fetch_all_items(user, method): max_id = None while True: - loop = asyncio.get_event_loop() - # Run the synchronous method in an executor to prevent blocking - response = await loop.run_in_executor(None, method, user['id'], 500, max_id) - if not response: - break + response = method(user['id'], limit=500, max_id=max_id) items.extend(response) if len(response) < 500: break max_id = response[-1]['id'] - logging.info(f"Final Max ID: {max_id}") - logging.info(f"Total Items Fetched: {len(items)}") + # Logging + logging.info(f"Method: {method}") + logging.info(f"User: {user}") + logging.info(f"Max ID: {max_id}") + logging.info(f"Response: {response}") + logging.info(f"Response length: {len(response)}") + logging.info(f"Items length: {len(items)}") return items