fix blob_get
This commit is contained in:
parent
f8c0e80cfc
commit
b134e0c9c9
1 changed files with 5 additions and 3 deletions
|
@ -2927,10 +2927,12 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
|
|
||||||
blob = await download_blob(asyncio.get_event_loop(), self.conf, self.blob_manager, self.dht_node, blob_hash)
|
blob = await download_blob(asyncio.get_event_loop(), self.conf, self.blob_manager, self.dht_node, blob_hash)
|
||||||
if read:
|
if read:
|
||||||
with open(blob.file_path, 'rb') as handle:
|
with blob.reader_context() as handle:
|
||||||
return handle.read().decode()
|
return handle.read().decode()
|
||||||
else:
|
elif isinstance(blob, BlobBuffer):
|
||||||
return "Downloaded blob %s" % blob_hash
|
log.warning("manually downloaded blob buffer could have missed garbage collection, clearing it")
|
||||||
|
blob.delete()
|
||||||
|
return "Downloaded blob %s" % blob_hash
|
||||||
|
|
||||||
@requires(BLOB_COMPONENT, DATABASE_COMPONENT)
|
@requires(BLOB_COMPONENT, DATABASE_COMPONENT)
|
||||||
async def jsonrpc_blob_delete(self, blob_hash):
|
async def jsonrpc_blob_delete(self, blob_hash):
|
||||||
|
|
Loading…
Reference in a new issue