fix: [sync client] don't launch client if ail server not linked with a sync queue

This commit is contained in:
Terrtia 2021-11-30 16:49:44 +01:00
parent 23ad74c591
commit 0a9caf75c9
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -267,7 +267,7 @@ def refresh_ail_instance_connection(ail_uuid):
client_id = clients_id[0] client_id = clients_id[0]
else: else:
client_id = None client_id = None
launch_required = is_ail_instance_push_enabled(ail_uuid) launch_required = is_ail_instance_push_enabled(ail_uuid) and is_ail_instance_linked_to_sync_queue(ail_uuid)
# relaunch # relaunch
if client_id and launch_required: if client_id and launch_required:
@ -312,7 +312,7 @@ class AIL2AILClientManager(object):
def get_all_sync_clients_to_launch(self): def get_all_sync_clients_to_launch(self):
ail_instances_to_launch = [] ail_instances_to_launch = []
for ail_uuid in get_all_ail_instance(): for ail_uuid in get_all_ail_instance():
if is_ail_instance_push_enabled(ail_uuid): if is_ail_instance_push_enabled(ail_uuid) and is_ail_instance_linked_to_sync_queue(ail_uuid):
ail_instances_to_launch.append(ail_uuid) ail_instances_to_launch.append(ail_uuid)
return ail_instances_to_launch return ail_instances_to_launch
@ -466,6 +466,9 @@ def is_ail_instance_sync_enabled(ail_uuid, sync_mode=None):
else: else:
return False return False
def is_ail_instance_linked_to_sync_queue(ail_uuid):
return r_serv_sync.exists(f'ail:instance:sync_queue:{ail_uuid}')
def change_pull_push_state(ail_uuid, pull=None, push=None): def change_pull_push_state(ail_uuid, pull=None, push=None):
edited = False edited = False
curr_pull = is_ail_instance_pull_enabled(ail_uuid) curr_pull = is_ail_instance_pull_enabled(ail_uuid)