Fixed TG messages quotes. Fixed sync tasks loop.

This commit is contained in:
Ultradesu
2025-09-17 13:54:48 +03:00
parent f304825836
commit d4042435fe
2 changed files with 10 additions and 4 deletions

View File

@@ -276,9 +276,14 @@ def certificate_updated(sender, instance, created, **kwargs):
# Schedule sync for each affected server
for server in servers_to_sync:
transaction.on_commit(
lambda srv=server: srv.sync_inbounds()
)
# Only sync if server has sync_inbounds method (Xray servers)
real_server = server.get_real_instance()
if hasattr(real_server, 'sync_inbounds'):
transaction.on_commit(
lambda srv=real_server: srv.sync_inbounds()
)
else:
logger.debug(f"Server {server.name} does not support inbound sync")
@receiver(post_save, sender=SubscriptionGroup)

View File

@@ -297,7 +297,8 @@ def sync_users(self, server_id):
logger.info(f"Directly synced {added_count} users for Xray server {server.name}")
else:
# For non-Xray servers, sync users directly (non-Xray servers should not create tasks)
sync_result = server.sync_all_users()
real_server = server.get_real_instance()
sync_result = real_server.sync_users()
# Check if sync was successful (can be boolean or dict/string)
sync_successful = bool(sync_result) and (