From 85cf709d6f939257c5cb3391fb2209c11d4c41b1 Mon Sep 17 00:00:00 2001 From: Deimos Date: Tue, 11 Sep 2018 12:33:55 -0600 Subject: [PATCH] Topic metadata generator: skip deleted topics Not really a big deal, but deleted topics are getting sent back through this consumer when the clean_private_data script erases their data, since that changes the markdown and puts them into the topic.edited queue. There shouldn't be any reason to process deleted topics and re-add "blank" metadata (0 word count, no excerpt), so we can just skip them. --- tildes/consumers/topic_metadata_generator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tildes/consumers/topic_metadata_generator.py b/tildes/consumers/topic_metadata_generator.py index 1b04ab7..d6214f5 100644 --- a/tildes/consumers/topic_metadata_generator.py +++ b/tildes/consumers/topic_metadata_generator.py @@ -33,6 +33,9 @@ class TopicMetadataGenerator(PgsqlQueueConsumer): self.db_session.query(Topic).filter_by(topic_id=msg.body["topic_id"]).one() ) + if topic.is_deleted: + return + if topic.is_text_type: new_metadata = self._generate_text_metadata(topic) elif topic.is_link_type: