forked from LBRYCommunity/lbry-sdk
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))
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def load_file_attributes(self):
|
||||
sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash)
|
||||
if sd_hash:
|
||||
self.sd_hash = sd_hash[0]
|
||||
def load_file_attributes(self, sd_hash=None):
|
||||
if not sd_hash:
|
||||
sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash)
|
||||
if sd_hash:
|
||||
self.sd_hash = sd_hash[0]
|
||||
else:
|
||||
raise NoSuchStreamHash(self.stream_hash)
|
||||
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)
|
||||
if stream_metadata:
|
||||
name, txid, nout = stream_metadata
|
||||
|
|
|
@ -41,7 +41,7 @@ class Publisher(object):
|
|||
|
||||
claim_out = yield self.make_claim(name, bid, claim_dict)
|
||||
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()
|
||||
defer.returnValue(claim_out)
|
||||
|
||||
|
|
Loading…
Reference in a new issue