diff options
author | jola-mirecka <jola.mirecka@hp.com> | 2013-09-04 19:32:09 +0100 |
---|---|---|
committer | Darrell Bishop <darrell@swiftstack.com> | 2013-11-28 13:02:54 -0500 |
commit | 9b7e24c4499c248995d09ea99b46d1678f7a3afb (patch) | |
tree | a3fe30b34e100e1c6e478070eb7530246e468675 /swiftclient/client.py | |
parent | a253b5cecd95137069bdf40e4b18abada6f15a22 (diff) | |
download | python-swiftclient-9b7e24c4499c248995d09ea99b46d1678f7a3afb.tar.gz |
Fix download bandwidth for swift command.
We noticed a difference in download bandwidth while using
authentication details and pre-auth information for download.
Download using authentication details included authentication
time into the download bandwidth at each call of the function.
This time should have been excluded from download bandwidth.
This patch set is adding a timer variable to the client library.
That allows to accurately measure and store the time of each action.
Then while printing the download bandwith in the swift command
authentication time is excluded from bandwidth.
Change-Id: I63df9023e169f637f120ae9e25dac9c90a4e75a0
Fixes: bug #1197443
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r-- | swiftclient/client.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index 8dc4b71..e97c30e 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -26,7 +26,7 @@ from functools import wraps from urllib import quote as _quote from urlparse import urlparse, urlunparse from httplib import HTTPException, HTTPConnection, HTTPSConnection -from time import sleep +from time import sleep, time from swiftclient.exceptions import ClientException, InvalidHeadersException @@ -1071,6 +1071,7 @@ class Connection(object): self.cacert = cacert self.insecure = insecure self.ssl_compression = ssl_compression + self.auth_end_time = 0 def get_auth(self): return get_auth(self.authurl, self.user, self.key, @@ -1104,6 +1105,7 @@ class Connection(object): if not self.url or not self.token: self.url, self.token = self.get_auth() self.http_conn = None + self.auth_end_time = time() if not self.http_conn: self.http_conn = self.http_connection() kwargs['http_conn'] = self.http_conn |