From 6d5a9eb127ba1fb3f29c90f868f5bb7ab2aaa97c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 17 Nov 2022 12:00:19 +0000 Subject: [PATCH] Remove from cache after chaning id --- daemon.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/daemon.py b/daemon.py index 87130cd1a..4d879df02 100644 --- a/daemon.py +++ b/daemon.py @@ -449,22 +449,6 @@ class PubServer(BaseHTTPRequestHandler): a published and updated date to it, and uses the previous id """ - # ensure that the cached post is removed if it exists, - # so that it then will be recreated - cached_post_filename = \ - get_cached_post_filename(base_dir, nickname, domain, - message_json) - if cached_post_filename: - if os.path.isfile(cached_post_filename): - try: - os.remove(cached_post_filename) - except OSError: - print('EX: _update_edited_post ' + - 'unable to delete ' + - cached_post_filename) - # remove from memory cache - remove_post_from_cache(message_json, recent_posts_cache) - edited_updated = \ message_json['object']['published'] if edited_published: @@ -484,6 +468,22 @@ class PubServer(BaseHTTPRequestHandler): edited_updated message_json['type'] = 'Update' + # ensure that the cached post is removed if it exists, + # so that it then will be recreated + cached_post_filename = \ + get_cached_post_filename(base_dir, nickname, domain, + message_json) + if cached_post_filename: + if os.path.isfile(cached_post_filename): + try: + os.remove(cached_post_filename) + except OSError: + print('EX: _update_edited_post ' + + 'unable to delete ' + + cached_post_filename) + # remove from memory cache + remove_post_from_cache(message_json, recent_posts_cache) + def _convert_domains(self, calling_domain, referer_domain, msg_str: str) -> str: """Convert domains to onion or i2p, depending upon who is asking