speed up search

get results for get_est_cost from lighthouse instead of manually trying
unless force=True
This commit is contained in:
Jack 2016-08-17 02:38:59 -04:00
parent 1159204ed8
commit 1ddb02dbb7

View file

@ -1785,7 +1785,13 @@ class LBRYDaemon(jsonrpc.JSONRPC):
"""
name = p['name']
d = self._get_est_cost(name)
force = p.get('force', False)
if force:
d = self._get_est_cost(name)
else:
d = self._search(name)
d.addCallback(lambda r: [i['cost'] for i in r][0])
d.addCallback(lambda r: self._render_response(r, OK_CODE))
return d