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:
parent
487939fec0
commit
0ed4736dd0
1 changed files with 5 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue