Skip to content

Commit

Permalink
Reduce discprov ipfs fetch timeouts and block proc window (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
SidSethi committed Feb 12, 2020
1 parent 8014be1 commit 6847dac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion discovery-provider/default_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
start_block = 0x0
loglevel_flask = DEBUG
loglevel_celery = INFO
block_processing_window = 100
block_processing_window = 20
blacklist_block_processing_window = 600
peer_refresh_interval = 3000
identity_service_url = https://identityservice.test
Expand Down
8 changes: 4 additions & 4 deletions discovery-provider/src/utils/ipfs_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_metadata_from_gateway(self, multihash, metadata_format):

try:
logger.warning(f"IPFSCLIENT | Querying {gateway_query_address}")
r = requests.get(gateway_query_address, timeout=8)
r = requests.get(gateway_query_address, timeout=3)

# Do not retrieve metadata for error code
if r.status_code != 200:
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_metadata_from_ipfs_node(self, multihash, metadata_format):

def cat(self, multihash):
try:
res = self._api.cat(multihash, timeout=8)
res = self._api.cat(multihash, timeout=3)
return res
except:
logger.error(f"IPFSCLIENT | IPFS cat timed out for CID {multihash}")
Expand All @@ -186,7 +186,7 @@ def multihash_is_directory(self, multihash):
r = None
try:
logger.warning(f"IPFSCLIENT | Querying {gateway_query_address}")
r = requests.get(gateway_query_address, timeout=8)
r = requests.get(gateway_query_address, timeout=3)
except Exception as e:
logger.warning(f"Failed to query {gateway_query_address} with error {e}")

Expand All @@ -210,7 +210,7 @@ def multihash_is_directory(self, multihash):
r = None
try:
logger.warning(f"IPFSCLIENT | Querying {gateway_query_address}")
r = requests.get(gateway_query_address, timeout=8)
r = requests.get(gateway_query_address, timeout=3)
except Exception as e:
logger.warning(f"Failed to query {gateway_query_address}, {e}")

Expand Down

0 comments on commit 6847dac

Please sign in to comment.