mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
OP-1905 - implemented exit on key interrupt
This commit is contained in:
parent
de8cfeff7f
commit
1772e7bf8d
3 changed files with 11 additions and 1 deletions
|
|
@ -246,6 +246,7 @@ class SyncServerThread(threading.Thread):
|
|||
|
||||
asyncio.ensure_future(self.check_shutdown(), loop=self.loop)
|
||||
asyncio.ensure_future(self.sync_loop(), loop=self.loop)
|
||||
log.info("Sync Server Started")
|
||||
self.loop.run_forever()
|
||||
except Exception:
|
||||
log.warning(
|
||||
|
|
|
|||
|
|
@ -771,6 +771,7 @@ class SyncServerModule(OpenPypeModule, ITrayModule):
|
|||
log.info("Stopping sync server server")
|
||||
self.sync_server_thread.is_running = False
|
||||
self.sync_server_thread.stop()
|
||||
log.info("Sync server stopped")
|
||||
except Exception:
|
||||
log.warning(
|
||||
"Error has happened during Killing sync server",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
from datetime import datetime
|
||||
import time
|
||||
|
||||
from openpype.lib import PypeLogger
|
||||
|
|
@ -332,8 +331,17 @@ class PypeCommands:
|
|||
|
||||
def syncserver(self, active_site):
|
||||
"""Start running sync_server in background."""
|
||||
import signal
|
||||
os.environ["SITE_SYNC_LOCAL_ID"] = active_site
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
print("You pressed Ctrl+C. Process ended.")
|
||||
sync_server_module.server_exit()
|
||||
sys.exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
from openpype.modules import ModulesManager
|
||||
|
||||
manager = ModulesManager()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue