diff --git a/requirements.txt b/requirements.txt index 566fe0f..548f96a 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/server/main.py b/server/main.py index 15ffc18..5d9d1a5 100644 --- a/server/main.py +++ b/server/main.py @@ -11,6 +11,12 @@ checkModules() +from src.helpers import setProcessPriority + +# Define a prioridade do processo do Python para alta +setProcessPriority() + + from src.http import startHTTPServer from src.websocket import startWebSocketServer diff --git a/server/src/helpers.py b/server/src/helpers.py index 38500f3..343fd02 100644 --- a/server/src/helpers.py +++ b/server/src/helpers.py @@ -182,3 +182,18 @@ def getVersion(): return content["version"] except: return "0.0.0" + + +# Define a prioridade do processo do Python para alta +def setProcessPriority(): + try: + import psutil + + proc = psutil.Process(os.getpid()) + + if os.name == "nt": + proc.nice(psutil.HIGH_PRIORITY_CLASS) + else: + proc.nice(-10) + except: + pass diff --git a/server/src/server.py b/server/src/server.py deleted file mode 100644 index fcb4756..0000000 --- a/server/src/server.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from colorama import init as coloramaInit -import os - - -# Inicializa o colorama -coloramaInit(autoreset=True)