mirror of https://gitlab.com/bashrc2/epicyon
Clear post from caches before updating
parent
2132b01950
commit
20dd5e069a
|
@ -25,6 +25,7 @@ from content import validHashTag
|
|||
from utils import loadJson
|
||||
from utils import saveJson
|
||||
from utils import getStatusNumber
|
||||
from utils import clearFromPostCaches
|
||||
from inbox import storeHashTags
|
||||
|
||||
|
||||
|
@ -490,6 +491,7 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
|||
|
||||
storeHashTags(baseDir, 'news', blog)
|
||||
|
||||
clearFromPostCaches(baseDir, postId)
|
||||
if saveJson(blog, filename):
|
||||
updateFeedsOutboxIndex(baseDir, domain, postId + '.json')
|
||||
|
||||
|
|
20
utils.py
20
utils.py
|
@ -587,6 +587,26 @@ def locateNewsArrival(baseDir: str, domain: str,
|
|||
return None
|
||||
|
||||
|
||||
def clearFromPostCaches(baseDir: str, postId: str) -> None:
|
||||
"""Clears cached html for the given post, so that edits
|
||||
to news will appear
|
||||
"""
|
||||
filename = postId + '.html'
|
||||
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
|
||||
for acct in dirs:
|
||||
if '@' not in acct:
|
||||
continue
|
||||
if 'inbox@' in acct:
|
||||
continue
|
||||
cacheDir = os.path.join(baseDir + '/accounts/postcache', acct)
|
||||
postFilename = cacheDir + filename
|
||||
if os.path.isfile(postFilename):
|
||||
try:
|
||||
os.remove(postFilename)
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
|
||||
def locatePost(baseDir: str, nickname: str, domain: str,
|
||||
postUrl: str, replies=False) -> str:
|
||||
"""Returns the filename for the given status post url
|
||||
|
|
Loading…
Reference in New Issue