Improve downloader error handling
Instead of having an error cause a timeout, send the error directly to the callback
This commit is contained in:
parent
8075ced1af
commit
1151019186
1 changed files with 5 additions and 4 deletions
|
@ -85,9 +85,10 @@ class GetStream(object):
|
||||||
return self.exchange_rate_manager.to_lbc(self.max_key_fee).amount
|
return self.exchange_rate_manager.to_lbc(self.max_key_fee).amount
|
||||||
|
|
||||||
def start(self, stream_info, name):
|
def start(self, stream_info, name):
|
||||||
def _cause_timeout(err):
|
def _cancel(err):
|
||||||
log.info('Cancelling download')
|
if self.checker:
|
||||||
self.timeout_counter = self.timeout * 2
|
self.checker.stop()
|
||||||
|
self.finished.errback(err)
|
||||||
|
|
||||||
def _set_status(x, status):
|
def _set_status(x, status):
|
||||||
log.info("Download lbry://%s status changed to %s" % (self.resolved_name, status))
|
log.info("Download lbry://%s status changed to %s" % (self.resolved_name, status))
|
||||||
|
@ -138,7 +139,7 @@ class GetStream(object):
|
||||||
self._d.addCallback(lambda r: _set_status(r, DOWNLOAD_RUNNING_CODE))
|
self._d.addCallback(lambda r: _set_status(r, DOWNLOAD_RUNNING_CODE))
|
||||||
self._d.addCallback(get_downloader_factory)
|
self._d.addCallback(get_downloader_factory)
|
||||||
self._d.addCallback(make_downloader)
|
self._d.addCallback(make_downloader)
|
||||||
self._d.addCallbacks(self._start_download, _cause_timeout)
|
self._d.addCallbacks(self._start_download, _cancel)
|
||||||
self._d.callback(None)
|
self._d.callback(None)
|
||||||
|
|
||||||
return self.finished
|
return self.finished
|
||||||
|
|
Loading…
Reference in a new issue