Merge "[FileBackend] Clear swift connection on invalid HTTP responses."
This commit is contained in:
commit
b6fcfa633d
1 changed files with 14 additions and 0 deletions
|
|
@ -1218,6 +1218,19 @@ class SwiftFileBackend extends FileBackendStore {
|
|||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection to the Swift proxy
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function closeConnection() {
|
||||
if ( $this->conn ) {
|
||||
$this->conn->close(); // close active cURL handles in CF_Http object
|
||||
$this->sessionStarted = 0;
|
||||
$this->connContainerCache->clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cache key for a container
|
||||
*
|
||||
|
|
@ -1331,6 +1344,7 @@ class SwiftFileBackend extends FileBackendStore {
|
|||
}
|
||||
if ( $e instanceof InvalidResponseException ) { // possibly a stale token
|
||||
$this->srvCache->delete( $this->getCredsCacheKey( $this->auth->username ) );
|
||||
$this->closeConnection(); // force a re-connect and re-auth next time
|
||||
}
|
||||
wfDebugLog( 'SwiftBackend',
|
||||
get_class( $e ) . " in '{$func}' (given '" . FormatJson::encode( $params ) . "')" .
|
||||
|
|
|
|||
Loading…
Reference in a new issue