1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-12-27 14:58:59 +00:00

if no bots are learning from an account, delete it

This commit is contained in:
Lynne Megido 2019-09-07 19:37:48 +10:00
parent 487939fec0
commit 0ed4736dd0

View file

@ -95,8 +95,12 @@ db = MySQLdb.connect(
db=cfg['db_name']
)
print("Downloading posts")
print("Cleaning up database")
# delete any fedi accounts we no longer need
cursor = db.cursor()
cursor.execute("DELETE FROM fedi_accounts WHERE handle NOT IN (SELECT fedi_id FROM bot_learned_accounts);")
print("Downloading posts")
cursor.execute("SELECT `handle`, `outbox` FROM `fedi_accounts` ORDER BY RAND()")
accounts = cursor.fetchall()
with Pool(8) as p: