feat: introduce NewSearchService to orchestrate e-commerce searches and scrape product details.

This commit is contained in:
Michael committed 2025-11-29 11:05:01 +01:00
1 parent 97a8e7a951
commit 0f5c6dc1c6
2 files changed
+75 -7

No files matched your search

+8 -4
View File
@@ -382,10 +382,14 @@ async def search_products(
active_producers = len(generators)
async def producer(gen):
async for item in gen:
await queue.put(item)
await queue.put(None) # Sentinel
try:
async for item in gen:
await queue.put(item)
except Exception as e:
logger.error(f"Error in search producer: {e}")
finally:
await queue.put(None) # Sentinel
# Start producers
for gen in generators:
asyncio.create_task(producer(gen))