Commit 54c9164c authored by 段英荣's avatar 段英荣

modify

parent bff675bd
...@@ -68,9 +68,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query ...@@ -68,9 +68,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
recommend_topic_list=list() recommend_topic_list=list()
recommend_topic_dict = redis_client.hgetall(topic_recommend_redis_key) recommend_topic_dict = redis_client.hgetall(topic_recommend_redis_key)
if "data" in recommend_topic_dict: if b"data" in recommend_topic_dict:
recommend_topic_id_list = json.loads(recommend_topic_dict["data"]) recommend_topic_id_list = json.loads(recommend_topic_dict[b"data"])
cursor = recommend_topic_dict["cursor"] cursor = recommend_topic_dict[b"cursor"]
if len(recommend_topic_id_list) > (cursor+5): if len(recommend_topic_id_list) > (cursor+5):
recommend_topic_list = recommend_topic_id_list[cursor:cursor+5] recommend_topic_list = recommend_topic_id_list[cursor:cursor+5]
...@@ -134,8 +134,8 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query ...@@ -134,8 +134,8 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# else: # else:
# break # break
topic_id_list = recommend_topic_list.extend(topic_id_list) recommend_topic_list.extend(topic_id_list)
have_read_topic_id_list.extend(topic_id_list) have_read_topic_id_list.extend(recommend_topic_list)
if len(have_read_topic_id_list) > 30000: if len(have_read_topic_id_list) > 30000:
cut_len = len(have_read_topic_id_list)-30000 cut_len = len(have_read_topic_id_list)-30000
have_read_topic_id_list = have_read_topic_id_list[cut_len:] have_read_topic_id_list = have_read_topic_id_list[cut_len:]
...@@ -146,7 +146,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query ...@@ -146,7 +146,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# 每个session key保存15分钟 # 每个session key保存15分钟
redis_client.expire(redis_key, 60 * 60 * 24 * 30) redis_client.expire(redis_key, 60 * 60 * 24 * 30)
return topic_id_list return recommend_topic_list
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return [] return []
......
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