Buckets:

download
raw
1.37 kB
import asyncio
from pydantic import SecretStr
from openhands.core.logger import openhands_logger as logger
from openhands.server.types import AppMode
def schedule_gitlab_repo_sync(
user_id: str, keycloak_access_token: SecretStr | None = None
) -> None:
"""Schedule a background sync of GitLab repositories and webhook tracking.
Because the outer call is already a background task, we instruct the service
to store repository data synchronously (store_in_background=False) to avoid
nested background tasks while still keeping the overall operation async.
"""
async def _run():
try:
# Lazy import to avoid circular dependency:
# middleware -> gitlab_sync -> integrations.gitlab.gitlab_service
# -> openhands.integrations.gitlab.gitlab_service -> get_impl
# -> integrations.gitlab.gitlab_service (circular)
from integrations.gitlab.gitlab_service import SaaSGitLabService
service = SaaSGitLabService(
external_auth_id=user_id, external_auth_token=keycloak_access_token
)
await service.get_all_repositories(
'pushed', AppMode.SAAS, store_in_background=False
)
except Exception:
logger.warning('gitlab_repo_sync_failed', exc_info=True)
asyncio.create_task(_run())

Xet Storage Details

Size:
1.37 kB
·
Xet hash:
0ef1f88be90133641344669d7c46ed68aca8633e5fe03854cffd3ba1ae0a706d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.