Prevents claim resolve error from disrupting entire hide operation

This commit is contained in:
Oleg Silkin 2020-01-06 23:16:46 -05:00
parent 7916d8b7ff
commit 25eb4f9acd
2 changed files with 8 additions and 3 deletions

View file

@ -88,7 +88,10 @@ async def hide_comments(app, pieces: list) -> list:
for p in pieces:
claim_id = comment_cids[p['comment_id']]
if claim_id not in claims:
claims[claim_id] = await get_claim_from_id(app, claim_id, no_totals=True)
claim = await get_claim_from_id(app, claim_id)
if claim:
claims[claim_id] = claim
channel = claims[claim_id].get('signing_channel')
if validate_signature_from_claim(channel, p['signature'], p['signing_ts'], p['comment_id']):
comments_to_hide.append(p)
@ -100,7 +103,6 @@ async def hide_comments(app, pieces: list) -> list:
app, 'UPDATE', db.get_comments_by_id(app['reader'], comment_ids)
)
)
await job.wait()
return comment_ids

View file

@ -8,7 +8,10 @@ ID_LIST = {'claim_id', 'parent_id', 'comment_id', 'channel_id'}
async def get_claim_from_id(app, claim_id, **kwargs):
return (await request_lbrynet(app, 'claim_search', claim_id=claim_id, **kwargs))['items'][0]
try:
return (await request_lbrynet(app, 'claim_search', claim_id=claim_id, **kwargs))['items'][0]
except IndexError:
return
def clean_input_params(kwargs: dict):