mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
include latest tipped in cache load
This commit is contained in:
parent
c4dc5cd49a
commit
017a230cc1
2 changed files with 8 additions and 6 deletions
|
@ -172,6 +172,9 @@ def load_cache():
|
||||||
app.logger.info('loading top posters into cache')
|
app.logger.info('loading top posters into cache')
|
||||||
get_top_posters()
|
get_top_posters()
|
||||||
app.logger.info('done')
|
app.logger.info('done')
|
||||||
|
app.logger.info('loading latest tipped into cache')
|
||||||
|
get_latest_tipped_posts()
|
||||||
|
app.logger.info('done')
|
||||||
for i in [1, 3, 7, 30]:
|
for i in [1, 3, 7, 30]:
|
||||||
app.logger.info(f'loading top posts last {i} days into cache')
|
app.logger.info(f'loading top posts last {i} days into cache')
|
||||||
get_top_posts(i)
|
get_top_posts(i)
|
||||||
|
|
|
@ -43,10 +43,9 @@ def post_webhook(msg):
|
||||||
|
|
||||||
def get_latest_tipped_posts():
|
def get_latest_tipped_posts():
|
||||||
key_name = 'latest_tips'
|
key_name = 'latest_tips'
|
||||||
tipped_posts = rw_cache(key_name, None, 1200)
|
posts = []
|
||||||
|
tipped_posts = rw_cache(key_name)
|
||||||
if not tipped_posts:
|
if not tipped_posts:
|
||||||
new_data = []
|
|
||||||
w = Wallet()
|
w = Wallet()
|
||||||
data = {}
|
data = {}
|
||||||
for acc in w.accounts():
|
for acc in w.accounts():
|
||||||
|
@ -61,10 +60,10 @@ def get_latest_tipped_posts():
|
||||||
|
|
||||||
dates = sorted(data, reverse=True)
|
dates = sorted(data, reverse=True)
|
||||||
for d in dates:
|
for d in dates:
|
||||||
if not data[d] in new_data:
|
if not data[d] in posts:
|
||||||
new_data.append(data[d])
|
posts.append(data[d])
|
||||||
|
|
||||||
tipped_posts = rw_cache(key_name, new_data, 1200)
|
tipped_posts = rw_cache(key_name, posts)
|
||||||
|
|
||||||
return tipped_posts
|
return tipped_posts
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue