diff --git a/README.md b/README.md index 0bd7017..1953193 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,4 @@ After first start, you have to wait for ~5mins for the "processor" to create fir * Collect creation time of orig/new article, write it to permanent storage (sqlite3 for now) and display it. * Write better readme and little more docs. * Create view with some more info and stats (list of feeds, articles in redis, etc.) -* Create a routine to clear old articles from Redis (otherwise it will just fill up the disk space at some point...) * IDEA: Figure out how to monitor changes in article description (maybe just compare hashes?) and how to present them. (Right now, the code can store descriptions in redis, but nothing else) diff --git a/processor/app.py b/processor/app.py index bfff00a..783dc97 100644 --- a/processor/app.py +++ b/processor/app.py @@ -19,6 +19,7 @@ from diff_match_patch import diff_match_patch # Teď budeme kontrolovat jen titulky, ale postupně můžeme přidat i description článku CONFIG_FILE = "../data/config.yaml" +REDIS_ARTICLE_EXPIRE_SEC = 604800 config = confuse.Configuration('headline', __name__) config.set_file(CONFIG_FILE) @@ -44,7 +45,7 @@ article_count = 0 def write_article(article, rc): rval = json.dumps(article['content']) - rc.set(article['rss_id'], rval) + rc.set(article['rss_id'], rval, ex=REDIS_ARTICLE_EXPIRE_SEC) def process_diff(old, new, rss_id): diff = dmp.diff_main(old['title'], new['title'])