fix sd hash race condition when loading lbry file attributes
This commit is contained in:
parent
f33b14e325
commit
4224d63603
2 changed files with 10 additions and 6 deletions
|
@ -108,12 +108,16 @@ class ManagedEncryptedFileDownloader(EncryptedFileSaver):
|
||||||
num_blobs_known, status))
|
num_blobs_known, status))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def load_file_attributes(self):
|
def load_file_attributes(self, sd_hash=None):
|
||||||
sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash)
|
if not sd_hash:
|
||||||
if sd_hash:
|
sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash)
|
||||||
self.sd_hash = sd_hash[0]
|
if sd_hash:
|
||||||
|
self.sd_hash = sd_hash[0]
|
||||||
|
else:
|
||||||
|
raise NoSuchStreamHash(self.stream_hash)
|
||||||
else:
|
else:
|
||||||
raise NoSuchStreamHash(self.stream_hash)
|
self.sd_hash = sd_hash
|
||||||
|
|
||||||
stream_metadata = yield self.wallet.get_claim_metadata_for_sd_hash(self.sd_hash)
|
stream_metadata = yield self.wallet.get_claim_metadata_for_sd_hash(self.sd_hash)
|
||||||
if stream_metadata:
|
if stream_metadata:
|
||||||
name, txid, nout = stream_metadata
|
name, txid, nout = stream_metadata
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Publisher(object):
|
||||||
|
|
||||||
claim_out = yield self.make_claim(name, bid, claim_dict)
|
claim_out = yield self.make_claim(name, bid, claim_dict)
|
||||||
self.lbry_file.completed = True
|
self.lbry_file.completed = True
|
||||||
yield self.lbry_file.load_file_attributes()
|
yield self.lbry_file.load_file_attributes(sd_hash)
|
||||||
yield self.lbry_file.save_status()
|
yield self.lbry_file.save_status()
|
||||||
defer.returnValue(claim_out)
|
defer.returnValue(claim_out)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue