forked from LBRYCommunity/lbry-sdk
fix reading sd blob
TODO: add __enter__ and __exit__ methods to HashBlobReader to let it be used as a contextmanager
This commit is contained in:
parent
be78390793
commit
d1511cba54
2 changed files with 4 additions and 2 deletions
|
@ -33,6 +33,7 @@ class HashBlobReader_v0(object):
|
|||
if self.streaming is False:
|
||||
reactor.callLater(0, self.producer.resumeProducing)
|
||||
|
||||
|
||||
class HashBlobReader(object):
|
||||
"""
|
||||
This is a file like reader class that supports
|
||||
|
|
|
@ -331,8 +331,9 @@ class ReflectorServer(Protocol):
|
|||
return d
|
||||
|
||||
def determine_missing_blobs(self, sd_blob):
|
||||
with sd_blob.open_for_reading() as sd_file:
|
||||
sd_blob_data = sd_file.read()
|
||||
reader = sd_blob.open_for_reading()
|
||||
sd_blob_data = reader.read()
|
||||
reader.close()
|
||||
decoded_sd_blob = json.loads(sd_blob_data)
|
||||
return self.get_unvalidated_blobs_in_stream(decoded_sd_blob)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue