Code

Ticket #2973: fastcgi-threadpool-options.diff

File fastcgi-threadpool-options.diff, 1.4 KB (added by James Crasta <jcrasta@…>, 8 years ago)

Allow runfcgi to pass threadpool options to flup

Line 
1Index: django/core/servers/fastcgi.py
2===================================================================
3--- django/core/servers/fastcgi.py      (revision 3954)
4+++ django/core/servers/fastcgi.py      (working copy)
5@@ -33,9 +33,9 @@
6   method=IMPL          prefork or threaded (default prefork)
7   maxrequests=NUMBER   number of requests a child handles before it is
8                        killed and a new child is forked (0 = no limit).
9-  maxspare=NUMBER      max number of spare processes to keep running.
10-  minspare=NUMBER      min number of spare processes to prefork.
11-  maxchildren=NUMBER   hard limit number of processes in prefork mode.
12+  maxspare=NUMBER      max number of spare processes / threads
13+  minspare=NUMBER      min number of spare processes / threads.
14+  maxchildren=NUMBER   hard limit number of processes / threads
15   daemonize=BOOL       whether to detach from terminal.
16   pidfile=FILE         write the spawned process-id to this file.
17   workdir=DIRECTORY    change to this directory when daemonizing
18@@ -110,7 +110,11 @@
19         }
20     elif options['method'] in ('thread', 'threaded'):
21         from flup.server.fcgi import WSGIServer
22-        wsgi_opts = {}
23+        wsgi_opts = {
24+            'maxSpare': int(options["maxspare"]),
25+            'minSpare': int(options["minspare"]),
26+            'maxThreads': int(options["maxchildren"]),
27+        }
28     else:
29         return fastcgi_help("ERROR: Implementation must be one of prefork or thread.")
30