limit blobs to announce

This commit is contained in:
Jack Robison 2019-02-08 16:29:55 -05:00
parent e414cc5c48
commit da9b4e317a
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -308,16 +308,18 @@ class SQLiteStorage(SQLiteMixin):
r = transaction.execute( r = transaction.execute(
"select blob_hash from blob " "select blob_hash from blob "
"where blob_hash is not null and " "where blob_hash is not null and "
"(should_announce=1 or single_announce=1) and next_announce_time<? and status='finished'", "(should_announce=1 or single_announce=1) and next_announce_time<? and status='finished' "
(timestamp,) "order by next_announce_time asc limit ?",
(timestamp, int(self.conf.concurrent_blob_announcers * 10))
) )
else: else:
r = transaction.execute( r = transaction.execute(
"select blob_hash from blob where blob_hash is not null " "select blob_hash from blob where blob_hash is not null "
"and next_announce_time<? and status='finished'", (timestamp,) "and next_announce_time<? and status='finished' "
"order by next_announce_time asc limit ?",
(timestamp, int(self.conf.concurrent_blob_announcers * 10))
) )
blobs = [b[0] for b in r.fetchall()] return [b[0] for b in r.fetchall()]
return blobs
return self.db.run(get_and_update) return self.db.run(get_and_update)
def delete_blobs_from_db(self, blob_hashes): def delete_blobs_from_db(self, blob_hashes):