Add swift configuration options and default connection timeout
Fixes #1627
This commit is contained in:
parent
5c9d55ecbd
commit
13a30d45b1
1 changed files with 11 additions and 2 deletions
|
@ -27,11 +27,13 @@ _PartUploadMetadata = namedtuple('_PartUploadMetadata', ['path', 'offset', 'leng
|
|||
_SEGMENTS_KEY = 'segments'
|
||||
_SEGMENT_DIRECTORY = 'segments'
|
||||
_MAXIMUM_SEGMENT_SIZE = 5000000000 # 5 GB
|
||||
_DEFAULT_SWIFT_CONNECT_TIMEOUT = 5 # seconds
|
||||
|
||||
class SwiftStorage(BaseStorage):
|
||||
def __init__(self, metric_queue, swift_container, storage_path, auth_url, swift_user,
|
||||
swift_password, auth_version=None, os_options=None, ca_cert_path=None,
|
||||
temp_url_key=None, simple_path_concat=False):
|
||||
temp_url_key=None, simple_path_concat=False, connect_timeout=None,
|
||||
retry_count=None, retry_on_ratelimit=True):
|
||||
super(SwiftStorage, self).__init__()
|
||||
self._swift_container = swift_container
|
||||
|
||||
|
@ -45,6 +47,9 @@ class SwiftStorage(BaseStorage):
|
|||
self._swift_password = swift_password
|
||||
|
||||
self._temp_url_key = temp_url_key
|
||||
self._connect_timeout = connect_timeout
|
||||
self._retry_count = retry_count
|
||||
self._retry_on_ratelimit = retry_on_ratelimit
|
||||
|
||||
try:
|
||||
self._auth_version = int(auth_version or '2')
|
||||
|
@ -64,7 +69,11 @@ class SwiftStorage(BaseStorage):
|
|||
key=self._swift_password,
|
||||
|
||||
auth_version=self._auth_version,
|
||||
os_options=self._os_options
|
||||
os_options=self._os_options,
|
||||
|
||||
retry_on_ratelimit=self._retry_on_ratelimit,
|
||||
timeout=self._connect_timeout or _DEFAULT_SWIFT_CONNECT_TIMEOUT,
|
||||
retries=self._retry_count or 5,
|
||||
)
|
||||
|
||||
def _normalize_path(self, object_path):
|
||||
|
|
Reference in a new issue