mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
minor fixes, occupied socket ports are skipped and logger is renamed
This commit is contained in:
parent
4921783d1a
commit
f1c873fedc
3 changed files with 20 additions and 5 deletions
|
|
@ -170,6 +170,16 @@ def main_loop(ftrack_url, username, api_key, event_paths):
|
|||
if not ftrack_accessible and not printed_ftrack_error:
|
||||
print("Can't access Ftrack {}".format(ftrack_url))
|
||||
|
||||
if storer_thread is not None:
|
||||
storer_thread.stop()
|
||||
storer_thread.join()
|
||||
storer_thread = None
|
||||
|
||||
if processor_thread is not None:
|
||||
processor_thread.stop()
|
||||
processor_thread.join()
|
||||
processor_thread = None
|
||||
|
||||
printed_ftrack_error = True
|
||||
printed_mongo_error = True
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class SocketThread(threading.Thread):
|
|||
|
||||
def stop(self):
|
||||
self._is_running = False
|
||||
super().stop()
|
||||
|
||||
def process_to_die(self):
|
||||
if not self.connection:
|
||||
|
|
@ -40,9 +39,15 @@ class SocketThread(threading.Thread):
|
|||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock = sock
|
||||
|
||||
# Bind the socket to the port
|
||||
server_address = ("localhost", self.port)
|
||||
sock.bind(server_address)
|
||||
# Bind the socket to the port - skip already used ports
|
||||
while True:
|
||||
try:
|
||||
server_address = ("localhost", self.port)
|
||||
sock.bind(server_address)
|
||||
break
|
||||
except OSError:
|
||||
self.port += 1
|
||||
|
||||
self.log.debug(
|
||||
"Running Socked thread on {}:{}".format(*server_address)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from pype.ftrack.ftrack_server import FtrackServer
|
|||
from session_processor import ProcessSession
|
||||
from pypeapp import Logger
|
||||
|
||||
log = Logger().get_logger("Event storer")
|
||||
log = Logger().get_logger("Event processor")
|
||||
|
||||
|
||||
def main(args):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue