load overviews from cache

to be nice and avoid hammering the server during development
nntp
magical 2022-08-08 08:24:45 +00:00
parent d43b3f9979
commit 932e39ac0a
1 changed files with 9 additions and 6 deletions

View File

@ -97,7 +97,7 @@ class BBJNews(object):
"admins": [],
}
self.connect()
#self.connect()
#try:
# self.user = self("get_me")["data"]
@ -486,8 +486,15 @@ class BBJNews(object):
author_id = thread["author"]
print(usermap[author_id]["user_name"])
"""
response, count, first, last, name = self.conn.group(self.group)
if os.path.exists("overview_cache.bbj.json"):
with open("overview_cache.bbj.json", "rt") as f:
overviews = json.load(f)
else:
response, count, first, last, name = self.conn.group(self.group)
response, overviews = self.conn.over((first, None))
with open("overview_cache.bbj.json", "wt") as f:
json.dump(overviews, f)
# overviews is a list of (article_number, overview) tuples,
# one for each article.
@ -499,10 +506,6 @@ class BBJNews(object):
# :bytes - the number of bytes in the article
# :lines - the number of lines in the body (deprecated)
response, overviews = self.conn.over((first, None))
with open("overview_cache.bbj.json", "wt") as f:
json.dump(overviews, f)
if False:
# build up a map of message references
# we use a disjoint-set data structure