v1.0
This commit is contained in:
@@ -46,6 +46,8 @@ class YandexmarketMarketplaceApi(BaseMarketplaceApi):
|
||||
limiter = BatchLimiter()
|
||||
|
||||
async def send_stock_chunk(chunk):
|
||||
if not self.is_valid:
|
||||
return
|
||||
try:
|
||||
await limiter.acquire_yandexmarket(self.limiter_key)
|
||||
request_data = {
|
||||
@@ -57,9 +59,11 @@ class YandexmarketMarketplaceApi(BaseMarketplaceApi):
|
||||
if response.status != 200:
|
||||
logging.warning(
|
||||
f'Error occurred when sending stocks to [{self.marketplace.id}]')
|
||||
self.is_valid = False
|
||||
except Exception as e:
|
||||
logging.error(
|
||||
f'Exception occurred while sending stocks to marketplace ID [{self.marketplace.id}]: {str(e)}')
|
||||
self.is_valid = False
|
||||
|
||||
tasks = [send_stock_chunk(chunk) for chunk in chunks]
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
Reference in New Issue
Block a user