better log exception in EncryptedFileManager
The error message in #478 is too generic. This wraps the source of the error in a try/catch and logs the traceback.
This commit is contained in:
parent
77746cea5f
commit
6bdb0280be
1 changed files with 18 additions and 19 deletions
|
@ -113,31 +113,30 @@ class EncryptedFileManager(object):
|
||||||
log.debug("Checking %s streams", len(stream_hashes))
|
log.debug("Checking %s streams", len(stream_hashes))
|
||||||
yield defer.DeferredList(list(_iter_streams(stream_hashes)))
|
yield defer.DeferredList(list(_iter_streams(stream_hashes)))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def _restore_lbry_file(self, lbry_file):
|
|
||||||
try:
|
|
||||||
yield lbry_file.restore()
|
|
||||||
except Exception as err:
|
|
||||||
log.error("Failed to start stream: %s, error: %s", lbry_file.stream_hash, err)
|
|
||||||
self.lbry_files.remove(lbry_file)
|
|
||||||
# TODO: delete stream without claim instead of just removing from manager?
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _start_lbry_files(self):
|
def _start_lbry_files(self):
|
||||||
b_prm = self.session.base_payment_rate_manager
|
|
||||||
payment_rate_manager = NegotiatedPaymentRateManager(b_prm, self.session.blob_tracker)
|
|
||||||
yield self._check_stream_info_manager()
|
yield self._check_stream_info_manager()
|
||||||
lbry_files_and_options = yield self._get_all_lbry_files()
|
files_and_options = yield self._get_all_lbry_files()
|
||||||
dl = []
|
yield defer.DeferredList([
|
||||||
for rowid, stream_hash, options in lbry_files_and_options:
|
self._set_options_and_restore(rowid, stream_hash, options)
|
||||||
lbry_file = yield self.start_lbry_file(rowid, stream_hash, payment_rate_manager,
|
for rowid, stream_hash, options in files_and_options
|
||||||
blob_data_rate=options)
|
])
|
||||||
dl.append(self._restore_lbry_file(lbry_file))
|
|
||||||
log.debug("Started %s", lbry_file)
|
|
||||||
self.lbry_files_setup_deferred = defer.DeferredList(dl)
|
|
||||||
log.info("Started %i lbry files", len(self.lbry_files))
|
log.info("Started %i lbry files", len(self.lbry_files))
|
||||||
defer.returnValue(True)
|
defer.returnValue(True)
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def _set_options_and_restore(self, rowid, stream_hash, options):
|
||||||
|
try:
|
||||||
|
b_prm = self.session.base_payment_rate_manager
|
||||||
|
payment_rate_manager = NegotiatedPaymentRateManager(
|
||||||
|
b_prm, self.session.blob_tracker)
|
||||||
|
downloader = yield self.start_lbry_file(
|
||||||
|
rowid, stream_hash, payment_rate_manager, blob_data_rate=options)
|
||||||
|
yield downloader.restore()
|
||||||
|
except Exception:
|
||||||
|
log.exception('An error occurred while starting a lbry file (%s, %s, %s)',
|
||||||
|
rowid, stream_hash, options)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def start_lbry_file(self, rowid, stream_hash,
|
def start_lbry_file(self, rowid, stream_hash,
|
||||||
payment_rate_manager, blob_data_rate=None, upload_allowed=True,
|
payment_rate_manager, blob_data_rate=None, upload_allowed=True,
|
||||||
|
|
Loading…
Reference in a new issue