Merge branch 'main' of https://github.com/Notoric/scheduled-news-curation
This commit is contained in:
commit
4d240a68f4
|
@ -260,7 +260,9 @@ def get_all_news():
|
|||
def delete_old_news():
|
||||
print("Deleting old news articles...")
|
||||
|
||||
db.newsfeed.delete_many({'timestamp': {'$lt': datetime.now() - timedelta(hours=config['news']['article_lifetime']) }})
|
||||
hrs = int(config['news']['article_lifetime'])
|
||||
|
||||
db.newsfeed.delete_many({'timestamp': {'$lt': datetime.now() - timedelta(hours=hrs) }})
|
||||
|
||||
print("Old news articles deleted!")
|
||||
|
||||
|
@ -269,7 +271,7 @@ def delete_old_news():
|
|||
create_collections()
|
||||
|
||||
schedule.every(5).minutes.do(write_weather)
|
||||
schedule.every(config['news']['article_interval']).hours.do(get_all_news)
|
||||
schedule.every(int(config['news']['article_interval'])).hours.do(get_all_news)
|
||||
schedule.every(1).hours.do(delete_old_news)
|
||||
|
||||
write_weather()
|
Loading…
Reference in New Issue