Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bases/renku_data_services/data_tasks/task_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,18 @@ async def users_sync(dm: DependencyManager) -> None:
await asyncio.sleep(dm.config.long_task_period_s)


async def events_sync(dm: DependencyManager) -> None:
"""Sync users DB from keycloak."""
while True:
try:
await dm.syncer.events_sync(dm.kc_api)

except (asyncio.CancelledError, KeyboardInterrupt) as e:
logger.warning(f"Exiting: {e}")
else:
await asyncio.sleep(dm.config.long_task_period_s)


async def sync_admins_from_keycloak(dm: DependencyManager) -> None:
"""Sync all users from keycloak."""
while True:
Expand Down Expand Up @@ -401,6 +413,7 @@ def all_tasks(dm: DependencyManager) -> TaskDefininions:
"migrate_groups_make_all_public": lambda: migrate_groups_make_all_public(dm),
"migrate_user_namespaces_make_all_public": lambda: migrate_user_namespaces_make_all_public(dm),
"users_sync": lambda: users_sync(dm),
"events_sync": lambda: events_sync(dm),
"sync_admins_from_keycloak": lambda: sync_admins_from_keycloak(dm),
}
)