aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2018-12-06 16:15:05 +0100
committerRahiel Kasim <rahielkasim@gmail.com>2018-12-06 16:15:05 +0100
commit438ff77edcd76e7a18902d11abe389d2493910ba (patch)
treea2020bf69182865dcb622927deb92de2ffec82bb
parent00dce79f65ed0a06130dddd41be2aa123efffa06 (diff)
every week clean untagged tweets older than 15 months
-rw-r--r--hortiradar/database/clean.cron2
-rw-r--r--hortiradar/database/clean.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/hortiradar/database/clean.cron b/hortiradar/database/clean.cron
index 0bcee2b..b3460a5 100644
--- a/hortiradar/database/clean.cron
+++ b/hortiradar/database/clean.cron
@@ -4,4 +4,4 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HORTI=/home/rahiel/hortiradar
# m h dom mon dow user command
-30 2 * * * rahiel cd $HORTI/hortiradar/database && $HORTI/venv/bin/python ./clean.py
+@weekly rahiel cd $HORTI/hortiradar/database && chronic $HORTI/venv/bin/python ./clean.py 2>&1 | telegram-send -g --stdin
diff --git a/hortiradar/database/clean.py b/hortiradar/database/clean.py
index eab697e..2e86961 100644
--- a/hortiradar/database/clean.py
+++ b/hortiradar/database/clean.py
@@ -6,9 +6,9 @@ from keywords import get_db
tweets = get_db().tweets
# tweet timestamps are in UTC time
-two_weeks_ago = datetime.utcnow() - timedelta(days=14)
+limit = datetime.utcnow() - timedelta(days=31 * 15)
tweets.delete_many({
"num_keywords": 0,
- "datetime": {"$lt": two_weeks_ago}
+ "datetime": {"$lt": limit}
})