mirror of https://github.com/skygpu/skynet.git
Retry pin
parent
d5b04a673c
commit
fc513b89af
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue