Retry pin

add-txt2txt-models
Guillermo Rodriguez 2023-06-04 14:37:10 -03:00
parent d5b04a673c
commit fc513b89af
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
1 changed files with 14 additions and 5 deletions

View File

@ -485,12 +485,21 @@ def pinner(loglevel, ipfs_rpc, hyperion_url):
async def task_pin(cid: str):
logging.info(f'pinning {cid}...')
resp = await ipfs_node.a_pin(cid)
if resp.status_code != 200:
logging.error(f'error pinning {cid}:\n{resp.text}')
for i in range(6):
try:
with trio.move_on_after(5):
resp = await ipfs_node.a_pin(cid)
if resp.status_code != 200:
logging.error(f'error pinning {cid}:\n{resp.text}')
else:
logging.info(f'pinned {cid}')
else:
logging.info(f'pinned {cid}')
return
except trio.TooSlowError:
logging.error(f'timed out pinning {cid}')
logging.error(f'gave up pinning {cid}')
try:
async with trio.open_nursery() as n: