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
|
---
cinderclient/openstack/common/apiclient/client.py | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/cinderclient/openstack/common/apiclient/client.py
+++ b/cinderclient/openstack/common/apiclient/client.py
@@ -90,6 +90,7 @@
self.user_agent = user_agent or self.user_agent
self.times = [] # [("item", starttime, endtime), ...]
+ self.times_max_len = 200
self.timings = timings
# requests within the same session can reuse TCP connections from pool
@@ -142,6 +143,12 @@
def reset_timings(self):
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 request(self, method, url, **kwargs):
"""Send an http request with the specified characteristics.
@@ -173,6 +180,9 @@
if self.timings:
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]
self._http_log_resp(resp)
if resp.status_code >= 400:
|