Skip to content

Commit

Permalink
fix: Corrige problema com ping 999+ aumentando prioridade do processo
Browse files Browse the repository at this point in the history
  • Loading branch information
josejefferson committed Dec 29, 2024
1 parent 2a997f5 commit 6f51934
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
Binary file modified requirements.txt
Binary file not shown.
6 changes: 6 additions & 0 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions server/src/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 0 additions & 9 deletions server/src/server.py

This file was deleted.

0 comments on commit 6f51934

Please sign in to comment.