fix uncaught error stream_cost_estimate
This commit is contained in:
parent
8b11521868
commit
342ae231ea
2 changed files with 9 additions and 7 deletions
|
@ -19,7 +19,7 @@ at anytime.
|
|||
*
|
||||
|
||||
### Fixed
|
||||
*
|
||||
* Fix uncaught exception in `stream_cost_estimate`
|
||||
*
|
||||
*
|
||||
|
||||
|
|
|
@ -892,13 +892,15 @@ class Daemon(AuthJSONRPCServer):
|
|||
except Exception:
|
||||
claim_response = None
|
||||
|
||||
result = None
|
||||
if claim_response and 'claim' in claim_response:
|
||||
cost = yield self._get_est_cost_from_metadata(ClaimDict.load_dict(
|
||||
claim_response['claim']['value']), uri)
|
||||
rounded = round(cost, 5)
|
||||
defer.returnValue(rounded)
|
||||
else:
|
||||
defer.returnValue(None)
|
||||
if 'value' in claim_response['claim']:
|
||||
claim_value = ClaimDict.load_dict(claim_response['claim']['value'])
|
||||
cost = yield self._get_est_cost_from_metadata(claim_value, uri)
|
||||
result = round(cost, 5)
|
||||
else:
|
||||
log.warning("Failed to estimate cost for %s", uri)
|
||||
defer.returnValue(result)
|
||||
|
||||
def get_est_cost(self, uri, size=None):
|
||||
"""Get a cost estimate for a lbry stream, if size is not provided the
|
||||
|
|
Loading…
Add table
Reference in a new issue