From 0fd9f6ec6bd4d98c22ca4791e90e7f3697804a48 Mon Sep 17 00:00:00 2001
From: Jacob Kaplan-Moss <jacob@jacobian.org>
Date: Tue, 7 Nov 2006 02:01:16 +0000
Subject: [PATCH] Fixed $2973: added minspare/maxspare/maxchildren options to
 runfcgi.  Thanks, James Crasta.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 django/core/servers/fastcgi.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/django/core/servers/fastcgi.py b/django/core/servers/fastcgi.py
index 0df68dcf56..fccb7bf087 100644
--- a/django/core/servers/fastcgi.py
+++ b/django/core/servers/fastcgi.py
@@ -33,9 +33,9 @@ Optional Fcgi settings: (setting=value)
   method=IMPL          prefork or threaded (default prefork)
   maxrequests=NUMBER   number of requests a child handles before it is 
                        killed and a new child is forked (0 = no limit).
-  maxspare=NUMBER      max number of spare processes to keep running.
-  minspare=NUMBER      min number of spare processes to prefork.
-  maxchildren=NUMBER   hard limit number of processes in prefork mode.
+  maxspare=NUMBER      max number of spare processes / threads
+  minspare=NUMBER      min number of spare processes / threads.
+  maxchildren=NUMBER   hard limit number of processes / threads
   daemonize=BOOL       whether to detach from terminal.
   pidfile=FILE         write the spawned process-id to this file.
   workdir=DIRECTORY    change to this directory when daemonizing
@@ -110,7 +110,11 @@ def runfastcgi(argset=[], **kwargs):
         }
     elif options['method'] in ('thread', 'threaded'):
         from flup.server.fcgi import WSGIServer
-        wsgi_opts = {}
+        wsgi_opts = {
+            'maxSpare': int(options["maxspare"]),
+            'minSpare': int(options["minspare"]),
+            'maxThreads': int(options["maxchildren"]),
+        }
     else:
         return fastcgi_help("ERROR: Implementation must be one of prefork or thread.")