Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghaisheng committed Jul 26, 2024
1 parent b5022dc commit b1223e3
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,21 @@ def __init__(self, work_q: asyncio.Queue = None, task_docker=None):
self.max_results = 2000

async def _adaptor(self):
print("Starting _adaptor...")
try:
print("Starting _adaptor...")
while not self.worker.empty():
task: dict = await self.worker.get()
print(f"Got task: {task}")
if task.get("pending"):
print("Handling pending task...")
await self.runtime(context=task.get("pending"))
elif task.get("response"):
print("Handling response task...")
await self.parse(context=task)
print("Adaptor loop completed.")
except Exception as e:
print(f"Error in _adaptor: {e}")

while not self.worker.empty():
task: dict = await self.worker.get()
print(f"Processing task: {task}") # Debugging

if task.get("pending"):
await self.runtime(context=task.get("pending"))
elif task.get("response"):
await self.parse(context=task)

def _progress(self):
p = self.max_queue_size - self.worker.qsize() - self.power
Expand Down

0 comments on commit b1223e3

Please sign in to comment.