Added access logs.

This commit is contained in:
A B
2024-10-28 17:15:49 +00:00
parent 7cf99af20d
commit 0880401cc4
7 changed files with 145 additions and 61 deletions

View File

@ -29,11 +29,13 @@ def sync_all_users():
@shared_task(name="sync_all_users_on_server")
def sync_users(server_id):
from .models import Server
status = {}
try:
server = Server.objects.get(id=server_id)
server.sync_users()
logger.info(f"Successfully synced users for server {server.name}")
sync = server.sync_users()
if sync:
logger.info(f"Successfully synced users for server {server.name}")
return f"Successfully synced users for server {server.name}"
except Exception as e:
logger.error(f"Error syncing users for server {server.name}: {e}")
raise TaskFailedException(message=f"Error syncing users for server {server.name}")