Show More
@@ -15,8 +15,7 b'' | |||||
15 | # along with this program; if not, write to the Free Software Foundation, |
|
15 | # along with this program; if not, write to the Free Software Foundation, | |
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 |
|
17 | |||
18 |
|
18 | import gc | ||
19 |
|
||||
20 | import time |
|
19 | import time | |
21 | import logging |
|
20 | import logging | |
22 |
|
21 | |||
@@ -40,6 +39,7 b' class RequestWrapperTween(object):' | |||||
40 | def __init__(self, handler, registry): |
|
39 | def __init__(self, handler, registry): | |
41 | self.handler = handler |
|
40 | self.handler = handler | |
42 | self.registry = registry |
|
41 | self.registry = registry | |
|
42 | self.gc_max_requests = 25 | |||
43 |
|
43 | |||
44 | # one-time configuration code goes here |
|
44 | # one-time configuration code goes here | |
45 |
|
45 | |||
@@ -56,6 +56,10 b' class RequestWrapperTween(object):' | |||||
56 | count, '127.0.0.1', request.environ.get('REQUEST_METHOD'), |
|
56 | count, '127.0.0.1', request.environ.get('REQUEST_METHOD'), | |
57 | safe_str(get_access_path(request)), total, get_user_agent(request.environ)) |
|
57 | safe_str(get_access_path(request)), total, get_user_agent(request.environ)) | |
58 |
|
58 | |||
|
59 | if self.gc_max_requests and count % self.gc_max_requests == 0: | |||
|
60 | log.info('Performing gc.collect now') | |||
|
61 | gc.collect() | |||
|
62 | ||||
59 | return response |
|
63 | return response | |
60 |
|
64 | |||
61 |
|
65 |
General Comments 0
You need to be logged in to leave comments.
Login now