1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

use service_threads instead of hardcoding 8

This commit is contained in:
Lynne Megido 2019-09-10 14:22:31 +10:00
parent 4de3997b5a
commit bc6745ae02
2 changed files with 2 additions and 2 deletions

View file

@ -94,7 +94,7 @@ cursor = db.cursor()
print("Downloading posts") print("Downloading posts")
cursor.execute("SELECT `handle`, `outbox` FROM `fedi_accounts` ORDER BY RAND()") cursor.execute("SELECT `handle`, `outbox` FROM `fedi_accounts` ORDER BY RAND()")
accounts = cursor.fetchall() accounts = cursor.fetchall()
with Pool(8) as p: with Pool(cfg['service_threads']) as p:
p.map(scrape_posts, accounts) p.map(scrape_posts, accounts)
print("Done!") print("Done!")

View file

@ -23,7 +23,7 @@ print("Generating posts")
cursor.execute("SELECT handle FROM bots WHERE enabled = TRUE AND TIMESTAMPDIFF(MINUTE, last_post, CURRENT_TIMESTAMP()) > post_frequency") cursor.execute("SELECT handle FROM bots WHERE enabled = TRUE AND TIMESTAMPDIFF(MINUTE, last_post, CURRENT_TIMESTAMP()) > post_frequency")
bots = cursor.fetchall() bots = cursor.fetchall()
with Pool(8) as p: with Pool(cfg['service_threads']) as p:
p.map(functions.make_post, bots) p.map(functions.make_post, bots)
#TODO: other cron tasks should be done here, like updating profile pictures #TODO: other cron tasks should be done here, like updating profile pictures