Unecessary sleep when a connection needs to reauthenticate

Bug #1698397 reported by wolever
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
New
Undecided
Unassigned

Bug Description

client.Client will sleep for the backoff delay when it detects the need to reauthenticate:

    def _retry(self, reset_func, func, *args, **kwargs):
        backoff = self.starting_backoff
        while self.attempts <= self.retries or retried_auth:
            …
            try:
                …
            except ClientException as err:
                self._add_response_dict(caller_response_dict, kwargs)
                if err.http_status == 401:
                    if self.session:
                        should_retry = self.session.invalidate()
                    else:
                        # Without a proper session, just check for auth creds
                        should_retry = all((self.authurl, self.user, self.key))

                    self.url = self.token = self.service_token = None

                    if retried_auth or not should_retry:
                        raise
                    retried_auth = True
                …
            sleep(backoff)

This is, obviously, unnecessary.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.