Code

Ticket #2969: fastcgi.diff

File fastcgi.diff, 1.2 KB (added by mir@…, 8 years ago)

The promised patch

Line 
1--- a/django/core/servers/fastcgi.py
2+++ b/django/core/servers/fastcgi.py
3@@ -31,6 +31,8 @@ Optional Fcgi settings: (setting=value)
4   port=PORTNUM         port to listen on.
5   socket=FILE          UNIX socket to listen on.
6   method=IMPL          prefork or threaded (default prefork)
7+  maxrequests=NUMBER   if positive: how many requests a child handles
8+                       before it is killed and a new child forked.
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@@ -66,6 +68,7 @@ FASTCGI_OPTIONS = {
13     'maxspare': 5,
14     'minspare': 2,
15     'maxchildren': 50,
16+    'maxrequests': 0,
17 }
18 
19 def fastcgi_help(message=None):
20@@ -103,6 +106,7 @@ def runfastcgi(argset=[], **kwargs):
21             'maxSpare': int(options["maxspare"]),
22             'minSpare': int(options["minspare"]),
23             'maxChildren': int(options["maxchildren"]),
24+            'maxRequests': int(options["maxrequests"]),
25         }
26     elif options['method'] in ('thread', 'threaded'):
27         from flup.server.fcgi import WSGIServer