mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-21 06:08:12 +02:00
feat: introduce NewSearchService to orchestrate e-commerce searches and scrape product details.
This commit is contained in:
1 parent
97a8e7a951
commit
0f5c6dc1c6
2 files changed
+75
-7
No files matched your search
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user