Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/retry.py
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | class RetryingProxyStorage: | ||||
"""Storage implementation which retries adding objects when it specifically | """Storage implementation which retries adding objects when it specifically | ||||
fails (hash collision, integrity error). | fails (hash collision, integrity error). | ||||
""" | """ | ||||
def __init__(self, storage): | def __init__(self, storage): | ||||
self.storage = get_storage(**storage) | self.storage = get_storage(**storage) | ||||
def __getattr__(self, key): | def __getattr__(self, key): | ||||
if key == 'storage': | |||||
raise AttributeError(key) | |||||
return getattr(self.storage, key) | return getattr(self.storage, key) | ||||
@swh_retry | @swh_retry | ||||
def content_add(self, content: Iterable[Dict]) -> Dict: | def content_add(self, content: Iterable[Dict]) -> Dict: | ||||
contents = list(content) | contents = list(content) | ||||
return self.storage.content_add(contents) | return self.storage.content_add(contents) | ||||
@swh_retry | @swh_retry | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |