aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python3-hp3parclient/fix_hp3parclient_memory_leak.patch
blob: 25aebc0ec0ff41fd4d0c7fbdf73f732ad3e8ac97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
 hp3parclient/http.py |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/hp3parclient/http.py
+++ b/hp3parclient/http.py
@@ -66,6 +66,7 @@
         self.set_debug_flag(http_log_debug)
 
         self.times = []  # [("item", starttime, endtime), ...]
+        self.times_max_len = 200
 
         # httplib2 overrides
         self.force_exception_to_status_code = True
@@ -141,6 +142,12 @@
         """
         self.times = []
 
+    def get_timings_max_len(self):
+        return self.times_max_len
+
+    def set_timings_max_len(self, new_len):
+        self.times_max_len = new_len
+
     def _http_log_req(self, args, kwargs):
         if not self.http_log_debug:
             return
@@ -208,6 +215,9 @@
         resp, body = self.request(url, method, **kwargs)
         self.times.append(("%s %s" % (method, url),
                            start_time, time.time()))
+        # remove oldest items until we maintain max length
+        while len(self.times) > self.times_max_len:
+            del self.times[0]
         return resp, body

     def _do_reauth(self, url, method, ex, **kwargs):