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:
|
||||
(bool) true if successful
|
||||
"""
|
||||
|
||||
if announce_all:
|
||||
yield self.session.blob_manager.immediate_announce_all_blobs()
|
||||
else:
|
||||
|
@ -2814,11 +2815,9 @@ class Daemon(AuthJSONRPCServer):
|
|||
else:
|
||||
raise Exception('single argument must be specified')
|
||||
if not blob_hash:
|
||||
blobs = yield self.storage.get_blobs_for_stream(stream_hash)
|
||||
blob_hashes.extend([blob.blob_hash for blob in blobs if blob.get_is_verified()])
|
||||
|
||||
blobs = yield self.storage.get_blobs_for_stream(stream_hash, only_completed=True)
|
||||
blob_hashes.extend([blob.blob_hash for blob in blobs])
|
||||
yield self.session.blob_manager._immediate_announce(blob_hashes)
|
||||
|
||||
response = yield self._render_response(True)
|
||||
defer.returnValue(response)
|
||||
|
||||
|
|
|
@ -389,11 +389,14 @@ class SQLiteStorage(object):
|
|||
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):
|
||||
crypt_blob_infos = []
|
||||
stream_blobs = transaction.execute("select blob_hash, position, iv from stream_blob "
|
||||
"where stream_hash=?", (stream_hash, )).fetchall()
|
||||
if only_completed:
|
||||
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:
|
||||
for blob_hash, position, iv in stream_blobs:
|
||||
if blob_hash is not None:
|
||||
|
|
Loading…
Reference in a new issue