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

modify

parent 8ee7b05b
......@@ -86,10 +86,10 @@ class LinUCB:
for top_score in sorted_np_score_list:
for top_score_index in np_score_dict[top_score]:
top_tag_set.add(str(tag_list[top_score_index], encoding="utf-8"))
if len(top_tag_set) >= 10:
if len(top_tag_set) >= 100:
break
if len(top_tag_set) >= 10:
if len(top_tag_set) >= 100:
break
logging.info("duan add,device_id:%s,sorted_np_score_list:%s,np_score_dict:%s" % (str(device_id), str(sorted_np_score_list), str(np_score_dict)))
......
......@@ -123,15 +123,15 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# break
have_read_topic_id_list.extend(topic_id_list)
if len(have_read_topic_id_list) > 5000:
cut_len = len(have_read_topic_id_list)-5000
if 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:]
redis_dict = {
"have_read_topic_list": json.dumps(have_read_topic_id_list),
}
redis_client.hmset(redis_key, redis_dict)
# 每个session key保存15分钟
redis_client.expire(redis_key, 60 * 60 * 24 * 3)
redis_client.expire(redis_key, 60 * 60 * 24 * 30)
return topic_id_list
except:
......
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