Commit cb021642 authored by 段英荣's avatar 段英荣

modify bug

parent 55a14f0d
...@@ -206,10 +206,9 @@ class Topic(models.Model): ...@@ -206,10 +206,9 @@ class Topic(models.Model):
def get_tag_name_list(self, tag_id_list): def get_tag_name_list(self, tag_id_list):
try: try:
tag_name_list = list() tag_name_list = list()
for i in range(0, len(tag_name_list), 1000): for i in range(0, len(tag_id_list), 100):
query_results = Tag.objects.using(settings.SLAVE_DB_NAME).filter(id__in=tag_id_list[i:i + 1000]) query_terms_list = list(Tag.objects.using(settings.SLAVE_DB_NAME).filter(id__in=tag_id_list[i:i + 100],is_online=True,is_deleted=False).values_list("name",flat=True))
for item in query_results: tag_name_list.extend(query_terms_list)
tag_name_list.append(item)
return tag_name_list return tag_name_list
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment