Prevents claim resolve error from disrupting entire hide operation
This commit is contained in:
parent
7916d8b7ff
commit
25eb4f9acd
2 changed files with 8 additions and 3 deletions
|
@ -88,7 +88,10 @@ async def hide_comments(app, pieces: list) -> list:
|
||||||
for p in pieces:
|
for p in pieces:
|
||||||
claim_id = comment_cids[p['comment_id']]
|
claim_id = comment_cids[p['comment_id']]
|
||||||
if claim_id not in claims:
|
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')
|
channel = claims[claim_id].get('signing_channel')
|
||||||
if validate_signature_from_claim(channel, p['signature'], p['signing_ts'], p['comment_id']):
|
if validate_signature_from_claim(channel, p['signature'], p['signing_ts'], p['comment_id']):
|
||||||
comments_to_hide.append(p)
|
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)
|
app, 'UPDATE', db.get_comments_by_id(app['reader'], comment_ids)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
await job.wait()
|
await job.wait()
|
||||||
return comment_ids
|
return comment_ids
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,10 @@ ID_LIST = {'claim_id', 'parent_id', 'comment_id', 'channel_id'}
|
||||||
|
|
||||||
|
|
||||||
async def get_claim_from_id(app, claim_id, **kwargs):
|
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):
|
def clean_input_params(kwargs: dict):
|
||||||
|
|
Loading…
Reference in a new issue