Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed oracle/common/__init__.py
Empty file.
12 changes: 6 additions & 6 deletions oracle/oracle/common/ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

logger = logging.getLogger(__name__)

timeout = ClientTimeout(total=60)
timeout = ClientTimeout(total=180)

CACHE_SIZE = 1024
IPFS_CACHE = LimitedSizeDict(size_limit=CACHE_SIZE)
Expand All @@ -41,24 +41,24 @@ async def _fetch(_ipfs_hash):
return await response.json()
except BaseException as e: # noqa: E722
logger.exception(e)
pass

if LOCAL_IPFS_CLIENT_ENDPOINT:
try:
with ipfshttpclient.connect(LOCAL_IPFS_CLIENT_ENDPOINT) as client:
return client.get_json(_ipfs_hash)
except ipfshttpclient.exceptions.TimeoutError:
pass
except BaseException as e: # noqa: E722
logger.exception(e)

try:
with ipfshttpclient.connect(
INFURA_IPFS_CLIENT_ENDPOINT,
username=INFURA_IPFS_CLIENT_USERNAME,
password=INFURA_IPFS_CLIENT_PASSWORD,
timeout=180,
) as client:
return client.get_json(_ipfs_hash)
except ipfshttpclient.exceptions.TimeoutError:
pass
except BaseException as e: # noqa: E722
logger.exception(e)

data = await _fetch(_ipfs_hash)
if data:
Expand Down
2 changes: 1 addition & 1 deletion oracle/oracle/distributor/ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async def upload_claims(claims: Claims) -> str:
INFURA_IPFS_CLIENT_ENDPOINT,
username=INFURA_IPFS_CLIENT_USERNAME,
password=INFURA_IPFS_CLIENT_PASSWORD,
timeout=180,
) as client:
ipfs_id = client.add_json(claims)
client.pin.add(ipfs_id)
Expand Down Expand Up @@ -107,7 +108,6 @@ async def upload_claims(claims: Claims) -> str:
ipfs_ids.append(ipfs_id)
except Exception as e: # noqa: E722
logger.error(e)
logger.error("Failed to submit claims to Pinata")

if not ipfs_ids:
raise RuntimeError("Failed to submit claims to IPFS")
Expand Down