v1.0
This commit is contained in:
@@ -47,6 +47,7 @@ class WildberriesMarketplaceApi(BaseMarketplaceApi):
|
||||
chunks = utils.chunk_list(data, max_stocks)
|
||||
if not chunks:
|
||||
return
|
||||
self.init_session()
|
||||
limiter = BatchLimiter()
|
||||
|
||||
async def send_stock_chunk(chunk):
|
||||
@@ -67,11 +68,14 @@ class WildberriesMarketplaceApi(BaseMarketplaceApi):
|
||||
logging.error(
|
||||
f'Exception occurred while sending stocks to marketplace ID [{self.marketplace.id}]: {str(e)}')
|
||||
return False
|
||||
|
||||
tasks = [send_stock_chunk(chunk) for chunk in chunks]
|
||||
first_request = tasks[0]
|
||||
first_response = await first_request
|
||||
if not first_response:
|
||||
logging.error(f'Skipping marketplace [{self.marketplace.id}] because first request was unsuccessful')
|
||||
await self.session.close()
|
||||
return
|
||||
|
||||
await asyncio.gather(*tasks[1:])
|
||||
await self.session.close()
|
||||
|
||||
Reference in New Issue
Block a user