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__": if __name__ == "__main__":
startThreads() startThreads()
DashboardPlugins.startThreads() DashboardPlugins.startThreads()
# app.logger.addHandler(logging.StreamHandler())
app.run(host=app_ip, debug=False, port=app_port) app.run(host=app_ip, debug=False, port=app_port)

View File

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

View File

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