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