Updated HACS and also fixed Garadget #727

This commit is contained in:
ccostan
2020-04-09 21:29:27 -04:00
parent 51aab60dea
commit e6e0d442e9
65 changed files with 1510 additions and 1047 deletions

20
config/custom_components/hacs/hacsbase/task_factory.py Executable file → Normal file
View File

@@ -5,6 +5,10 @@ from datetime import timedelta
import asyncio
from aiogithubapi import AIOGitHubException
from custom_components.hacs.hacsbase.exceptions import HacsException
from custom_components.hacs.helpers.register_repository import register_repository
max_concurrent_tasks = asyncio.Semaphore(15)
sleeper = 5
@@ -44,8 +48,8 @@ class HacsTaskFactory:
async with max_concurrent_tasks:
try:
await repository.common_update()
except AIOGitHubException as exception:
logger.error(exception)
except (AIOGitHubException, HacsException) as exception:
logger.error("%s - %s", repository.data.full_name, exception)
# Due to GitHub ratelimits we need to sleep a bit
await asyncio.sleep(sleeper)
@@ -54,18 +58,18 @@ class HacsTaskFactory:
async with max_concurrent_tasks:
try:
await repository.update_repository()
except AIOGitHubException as exception:
logger.error(exception)
except (AIOGitHubException, HacsException) as exception:
logger.error("%s - %s", repository.data.full_name, exception)
# Due to GitHub ratelimits we need to sleep a bit
await asyncio.sleep(sleeper)
async def safe_register(self, hacs, repo, category):
async def safe_register(self, repo, category):
async with max_concurrent_tasks:
try:
await hacs.register_repository(repo, category)
except AIOGitHubException as exception:
logger.error(exception)
await register_repository(repo, category)
except (AIOGitHubException, HacsException) as exception:
logger.error("%s - %s", repo, exception)
# Due to GitHub ratelimits we need to sleep a bit
await asyncio.sleep(sleeper)