From 5751bafc3f65a6b6acf3d2d02dd17768e3ea27ae Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 11 May 2023 10:36:37 +0000 Subject: [PATCH] Toot once a day Signed-off-by: Michael Tremer --- src/backend/toots.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/backend/toots.py b/src/backend/toots.py index d434d6d9..271d4be3 100644 --- a/src/backend/toots.py +++ b/src/backend/toots.py @@ -11,11 +11,6 @@ class Toots(Object): """ Sends a random promotional toot """ - # Do not toot too often - if self.has_had_recent_activity(days=3): - logging.debug("Won't toot because we recently did it") - return - # Do not toot when there was a blog post if self.backend.blog.has_had_recent_activity(hours=24): logging.debug("Won't toot because the blog has had activity") @@ -31,17 +26,6 @@ class Toots(Object): with self.db.transaction(): self._toot(toot) - def has_had_recent_activity(self, **kwargs): - t = datetime.timedelta(**kwargs) - - res = self.db.get("SELECT COUNT(*) AS count FROM toots \ - WHERE last_tooted_at IS NOT NULL AND last_tooted_at >= NOW() - %s", t) - - if res and res.count > 0: - return True - - return False - def _get_random_toot(self): res = self.db.get( "WITH candidate_toots AS (SELECT id, \ -- 2.47.2