mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-09-01 17:55:13 +00:00
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:
|
if self.streaming is False:
|
||||||
reactor.callLater(0, self.producer.resumeProducing)
|
reactor.callLater(0, self.producer.resumeProducing)
|
||||||
|
|
||||||
|
|
||||||
class HashBlobReader(object):
|
class HashBlobReader(object):
|
||||||
"""
|
"""
|
||||||
This is a file like reader class that supports
|
This is a file like reader class that supports
|
||||||
|
|
|
@ -331,8 +331,9 @@ class ReflectorServer(Protocol):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def determine_missing_blobs(self, sd_blob):
|
def determine_missing_blobs(self, sd_blob):
|
||||||
with sd_blob.open_for_reading() as sd_file:
|
reader = sd_blob.open_for_reading()
|
||||||
sd_blob_data = sd_file.read()
|
sd_blob_data = reader.read()
|
||||||
|
reader.close()
|
||||||
decoded_sd_blob = json.loads(sd_blob_data)
|
decoded_sd_blob = json.loads(sd_blob_data)
|
||||||
return self.get_unvalidated_blobs_in_stream(decoded_sd_blob)
|
return self.get_unvalidated_blobs_in_stream(decoded_sd_blob)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue