Browse Source

whatever?

lyc8503 4 years ago
parent
commit
4f1270b75b
2 changed files with 8 additions and 4 deletions
  1. 1 3
      backend_refactor/app.py
  2. 7 1
      backend_refactor/gunicorn.conf.py

+ 1 - 3
backend_refactor/app.py

@@ -66,8 +66,6 @@ def error_handler(e):
     return make_response(500, "unknown internal server error.", {})
 
 
-init_workers()
-
-
 if __name__ == '__main__':
     app.run()
+    init_workers()

+ 7 - 1
backend_refactor/gunicorn.conf.py

@@ -1,4 +1,5 @@
 # Sample Gunicorn configuration file.
+from pool.thread_pool import init_workers
 
 #
 # Server socket
@@ -65,7 +66,7 @@ backlog = 2048
 #       A positive integer. Generally set in the 1-5 seconds range.
 #
 
-workers = 1
+workers = 5
 worker_class = 'sync'
 worker_connections = 1000
 timeout = 15
@@ -181,6 +182,11 @@ proc_name = None
 #       A callable that takes a server instance as the sole argument.
 #
 
+
+def on_starting():
+    init_workers()
+
+
 def post_fork(server, worker):
     server.log.info("Worker spawned (pid: %s)", worker.pid)