Use threading event in main loop.

This commit is contained in:
tecnovert
2023-09-17 22:34:48 +02:00
parent 20b405a944
commit e7ae290eb5
3 changed files with 10 additions and 12 deletions

View File

@@ -1,14 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2022 tecnovert
# Copyright (c) 2019-2023 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import os
import sys
import json
import time
import shutil
import signal
import logging
@@ -210,8 +209,7 @@ def runClient(fp, data_dir, chain):
swap_client.ws_server.run_forever(threaded=True)
logger.info('Exit with Ctrl + c.')
while swap_client.is_running:
time.sleep(0.5)
while not swap_client.delay_event.wait(0.5):
swap_client.update()
except Exception as ex: