forked from LBRYCommunity/lbry-sdk
fix blob_announce command
This commit is contained in:
parent
01c4c6ed97
commit
7862ee6715
2 changed files with 9 additions and 7 deletions
|
@ -2801,6 +2801,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
Returns:
|
Returns:
|
||||||
(bool) true if successful
|
(bool) true if successful
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if announce_all:
|
if announce_all:
|
||||||
yield self.session.blob_manager.immediate_announce_all_blobs()
|
yield self.session.blob_manager.immediate_announce_all_blobs()
|
||||||
else:
|
else:
|
||||||
|
@ -2814,11 +2815,9 @@ class Daemon(AuthJSONRPCServer):
|
||||||
else:
|
else:
|
||||||
raise Exception('single argument must be specified')
|
raise Exception('single argument must be specified')
|
||||||
if not blob_hash:
|
if not blob_hash:
|
||||||
blobs = yield self.storage.get_blobs_for_stream(stream_hash)
|
blobs = yield self.storage.get_blobs_for_stream(stream_hash, only_completed=True)
|
||||||
blob_hashes.extend([blob.blob_hash for blob in blobs if blob.get_is_verified()])
|
blob_hashes.extend([blob.blob_hash for blob in blobs])
|
||||||
|
|
||||||
yield self.session.blob_manager._immediate_announce(blob_hashes)
|
yield self.session.blob_manager._immediate_announce(blob_hashes)
|
||||||
|
|
||||||
response = yield self._render_response(True)
|
response = yield self._render_response(True)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
|
|
|
@ -389,11 +389,14 @@ class SQLiteStorage(object):
|
||||||
stream_hash, blob_num
|
stream_hash, blob_num
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_blobs_for_stream(self, stream_hash):
|
def get_blobs_for_stream(self, stream_hash, only_completed=False):
|
||||||
def _get_blobs_for_stream(transaction):
|
def _get_blobs_for_stream(transaction):
|
||||||
crypt_blob_infos = []
|
crypt_blob_infos = []
|
||||||
stream_blobs = transaction.execute("select blob_hash, position, iv from stream_blob "
|
if only_completed:
|
||||||
"where stream_hash=?", (stream_hash, )).fetchall()
|
query = "select blob_hash, position, iv from stream_blob where stream_hash=? and status='finished'"
|
||||||
|
else:
|
||||||
|
query = "select blob_hash, position, iv from stream_blob where stream_hash=?"
|
||||||
|
stream_blobs = transaction.execute(query, (stream_hash, )).fetchall()
|
||||||
if stream_blobs:
|
if stream_blobs:
|
||||||
for blob_hash, position, iv in stream_blobs:
|
for blob_hash, position, iv in stream_blobs:
|
||||||
if blob_hash is not None:
|
if blob_hash is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue