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

implement wait between posts

This commit is contained in:
Lynne Megido 2019-09-10 11:50:55 +10:00
parent fb017468fd
commit 989a9ec98b
2 changed files with 3 additions and 3 deletions

View file

@ -124,4 +124,5 @@ def make_post(handle):
print(post) print(post)
client.status_post(post, visibility = bot['post_privacy'], spoiler_text = bot['content_warning']) client.status_post(post, visibility = bot['post_privacy'], spoiler_text = bot['content_warning'])
# TODO: update date of last post c.execute("UPDATE bots SET last_post = CURRENT_TIMESTAMP() WHERE handle = %s", (handle,))
db.commit()

View file

@ -104,8 +104,7 @@ accounts = cursor.fetchall()
# p.map(scrape_posts, accounts) # p.map(scrape_posts, accounts)
print("Generating posts") print("Generating posts")
# TODO: check time between last post and now 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")
bots = cursor.fetchall() bots = cursor.fetchall()
with Pool(8) as p: with Pool(8) as p: