From 5d2ff89acd5aea3682e74a1bc433643c5907546f Mon Sep 17 00:00:00 2001 From: andreymal Date: Sat, 8 Jun 2024 17:04:32 +0300 Subject: [PATCH] Clear chapter html cache after minor edits --- mini_fiction/bl/stories.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mini_fiction/bl/stories.py b/mini_fiction/bl/stories.py index 84404ef3..8004c589 100644 --- a/mini_fiction/bl/stories.py +++ b/mini_fiction/bl/stories.py @@ -1800,6 +1800,12 @@ def update(self, editor, data, minor=False): flags=flags, ) + # TODO: перенести всё кэширование из models куда-то сюда + if 'notes' in edited_data: + current_app.cache.delete(f"chapter_notes_html_{chapter.id}") + if chapter_text_diff: + current_app.cache.delete(f"chapter_text_html_{chapter.id}") + later(current_app.tasks['sphinx_update_chapter'].delay, chapter.id) return chapter