|
@@ -79,9 +79,6 @@ class PoolRecall(object):
|
|
|
|
|
|
def flow_pool_recall(self, size=10):
|
|
|
"""从流量池中获取视频"""
|
|
|
- return []
|
|
|
- # 暂时关闭流量池
|
|
|
- """
|
|
|
log_.info('====== flow pool recall')
|
|
|
flow_pool_key = self.get_pool_redis_key('flow')
|
|
|
flow_pool_recall_result = []
|
|
@@ -142,7 +139,6 @@ class PoolRecall(object):
|
|
|
idx += get_size
|
|
|
|
|
|
return flow_pool_recall_result[:size]
|
|
|
- """
|
|
|
|
|
|
def check_video_counts(self, video_ids, flow_pool_mapping):
|
|
|
"""
|
|
@@ -158,20 +154,20 @@ class PoolRecall(object):
|
|
|
videos.append({'videoId': video_id, 'flowPool': flow_pool})
|
|
|
view_count_result = get_videos_remain_view_count(app_type=self.app_type, videos=videos)
|
|
|
log_.info('view_count_result = {}'.format(view_count_result))
|
|
|
- if not view_count_result:
|
|
|
- return None
|
|
|
+
|
|
|
check_result = []
|
|
|
for item in view_count_result:
|
|
|
if item[2] > 0:
|
|
|
- # viewCount > 0,判断本地分发数
|
|
|
+ # viewCount > 0
|
|
|
+ # 判断本地分发数
|
|
|
cur_count = get_videos_local_distribute_count(video_id=item[0], flow_pool=item[1])
|
|
|
# 无记录 或 cur_count > 0
|
|
|
if cur_count is None or cur_count > 0:
|
|
|
check_result.append(item)
|
|
|
# cur_count <= 0,从流量召回池移除
|
|
|
- # else:
|
|
|
- # value = '{}-{}'.format(item[0], item[1])
|
|
|
- # self.redis_helper.remove_value_from_zset(key_name=flow_pool_key, value=value)
|
|
|
+ else:
|
|
|
+ value = '{}-{}'.format(item[0], item[1])
|
|
|
+ self.redis_helper.remove_value_from_zset(key_name=flow_pool_key, value=value)
|
|
|
else:
|
|
|
# viewCount <= 0
|
|
|
# 从流量召回池移除
|