Testing with 2 threads 1 worker

This commit is contained in:
Donald Zou
2025-09-15 22:09:57 +08:00
parent 3673813e6a
commit f231e9214c
3 changed files with 6 additions and 9 deletions

View File

@@ -1663,5 +1663,4 @@ def startThreads():
if __name__ == "__main__":
startThreads()
DashboardPlugins.startThreads()
# app.logger.addHandler(logging.StreamHandler())
app.run(host=app_ip, debug=False, port=app_port)

View File

@@ -10,7 +10,7 @@ def post_worker_init(worker):
worker_class = 'gthread'
workers = 1
threads = 1
threads = 2
bind = f"{app_host}:{app_port}"
daemon = True
pidfile = './gunicorn.pid'

View File

@@ -12,7 +12,6 @@ from flask import current_app
from .ConnectionString import ConnectionString
from .DashboardConfig import DashboardConfig
from .DashboardWebHooks import DashboardWebHooks
from .Peer import Peer
from .PeerJobs import PeerJobs
from .PeerShareLinks import PeerShareLinks
@@ -44,12 +43,10 @@ class WireguardConfiguration:
self.__parser: configparser.ConfigParser = configparser.RawConfigParser(strict=False)
self.__parser.optionxform = str
self.__configFileModifiedTime = None
self.Status: bool = False
self.Name: str = ""
self.PrivateKey: str = ""
self.PublicKey: str = ""
self.ListenPort: str = ""
self.Address: str = ""
self.DNS: str = ""
@@ -67,7 +64,7 @@ class WireguardConfiguration:
self.AllPeerShareLinks = AllPeerShareLinks
self.DashboardWebHooks = DashboardWebHooks
self.configPath = os.path.join(self.__getProtocolPath(), f'{self.Name}.conf')
self.engine: sqlalchemy.engine = sqlalchemy.create_engine(ConnectionString("wgdashboard"))
self.engine: sqlalchemy.Engine = sqlalchemy.create_engine(ConnectionString("wgdashboard"))
self.metadata: sqlalchemy.MetaData = sqlalchemy.MetaData()
self.dbType = self.DashboardConfig.GetConfig("Database", "type")[1]
@@ -145,9 +142,10 @@ class WireguardConfiguration:
self.addAutostart()
def __getProtocolPath(self):
return self.DashboardConfig.GetConfig("Server", "wg_conf_path")[1] if self.Protocol == "wg" \
else self.DashboardConfig.GetConfig("Server", "awg_conf_path")[1]
def __getProtocolPath(self) -> str:
_, path = self.DashboardConfig.GetConfig("Server", "wg_conf_path") if self.Protocol == "wg" \
else self.DashboardConfig.GetConfig("Server", "awg_conf_path")
return path
def __initPeersList(self):
self.Peers: list[Peer] = []