Old tweets delivered from cache, new ones never grabbed
ivan opened this issue · comments
I observed that my twitter-rss server was delivering tweets from July 4 instead of new ones, and realized it was unconditionally reading tweets from its cache instead of grabbing new tweets.
My config.py looks like this:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
TIMER = 2700
SERVER = 'localhost'
INSTALL_DIR = '/home/twitterrss/twitter-rss/' # where all config files are stored
XML_DIR = '/home/twitterrss/feeds/' # must exist and must have right to read/write the rss feeds
PICS = True
and I was running python run.py
.
As a workaround, I removed the read-from-cache code in server.py
:
diff --git a/server.py b/server.py
index 19b6a9a..981e9c0 100644
--- a/server.py
+++ b/server.py
@@ -27,15 +27,7 @@ def handle_htag():
@app.route('/<path>/<feed>.xml')
def feed_to_xml(feed, path):
- try:
- with open(config.XML_DIR + path + '/' + feed + '.xml') as tweets:
- tweets = tweets.read()
- if not tweets:
- err = 'Cache is empty'
- error = render_template('index.tpl', err=err)
- else:
- error = tweets
- except IOError:
+ if True:
try:
if path == 'user':
tweets = twitter_rss.UserTweetGetter(feed)
and started using python server.py
(since I have no need for cached tweets), and now I get new tweets.
You're right, if the file already exists, the script doesn't check if it needs to be updated.
The cache was meant to have a faster response if there were no new tweets, I will try to find a workaround.
Thanks for reporting this bug!