mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-09-15 07:59:41 +00:00
Updated HACS and also fixed Garadget #727
This commit is contained in:
20
config/custom_components/hacs/hacsbase/task_factory.py
Executable file → Normal file
20
config/custom_components/hacs/hacsbase/task_factory.py
Executable file → Normal 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)
|
||||
|
Reference in New Issue
Block a user