From f1020fb072c14bbcaca446a3f25a15939418f841 Mon Sep 17 00:00:00 2001 From: Swann Martinez Date: Fri, 14 Feb 2020 16:02:30 +0100 Subject: [PATCH] feat: prevent apply before session in active --- multi_user/delayable.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/multi_user/delayable.py b/multi_user/delayable.py index b3af08c..07578e8 100644 --- a/multi_user/delayable.py +++ b/multi_user/delayable.py @@ -64,15 +64,16 @@ class ApplyTimer(Timer): super().__init__(timout) def execute(self): - if operators.client: - nodes = operators.client.list(filter=self._type) + client = operators.client + if client and client.state['STATE'] == STATE_ACTIVE: + nodes = client.list(filter=self._type) for node in nodes: - node_ref = operators.client.get(uuid=node) + node_ref = client.get(uuid=node) if node_ref.state == FETCHED: try: - operators.client.apply(node) + client.apply(node) except Exception as e: logger.error( "fail to apply {}: {}".format(node_ref.uuid, e))