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): async def task_pin(cid: str):
logging.info(f'pinning {cid}...') logging.info(f'pinning {cid}...')
resp = await ipfs_node.a_pin(cid) for i in range(6):
if resp.status_code != 200: try:
logging.error(f'error pinning {cid}:\n{resp.text}') 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: else:
logging.info(f'pinned {cid}') logging.info(f'pinned {cid}')
return
except trio.TooSlowError:
logging.error(f'timed out pinning {cid}')
logging.error(f'gave up pinning {cid}')
try: try:
async with trio.open_nursery() as n: async with trio.open_nursery() as n: