|
@@ -928,7 +928,7 @@ class PoolRecall(object):
|
|
|
|
|
|
def flow_pool_recall_18_19(self, size=4, push_from=config_.PUSH_FROM['flow_recall']):
|
|
|
"""从流量池中获取视频"""
|
|
|
- # log_.info('====== flow pool recall')
|
|
|
+ start_time = time.time()
|
|
|
flow_pool_key = self.get_pool_redis_key('flow')
|
|
|
flow_pool_recall_result = []
|
|
|
flow_pool_recall_videos = []
|
|
@@ -939,12 +939,13 @@ class PoolRecall(object):
|
|
|
idx = 0
|
|
|
while len(flow_pool_recall_result) < size:
|
|
|
freq += 1
|
|
|
+ if freq > config_.MAX_FREQ_FROM_FLOW_POOL_18_19:
|
|
|
+ break
|
|
|
+
|
|
|
# 获取数据
|
|
|
- st_get = time.time()
|
|
|
data = self.redis_helper.get_data_zset_with_index(key_name=flow_pool_key,
|
|
|
start=idx, end=idx + get_size - 1,
|
|
|
with_scores=True)
|
|
|
- et_get = time.time()
|
|
|
# log_.info('get data from flow pool redis: freq = {}, data = {}, execute time = {}ms'.format(
|
|
|
# freq, data, (et_get - st_get) * 1000))
|
|
|
if not data:
|
|
@@ -973,6 +974,12 @@ class PoolRecall(object):
|
|
|
flow_pool_recall_result.extend(temp_result)
|
|
|
idx += get_size
|
|
|
|
|
|
+ log_.info({
|
|
|
+ 'logTimestamp': int(time.time() * 1000),
|
|
|
+ 'request_id': self.request_id,
|
|
|
+ 'operation': 'flow_pool_recall_18_19',
|
|
|
+ 'executeTime': (time.time() - start_time) * 1000
|
|
|
+ })
|
|
|
return flow_pool_recall_result[:size]
|
|
|
|
|
|
def get_pool_redis_key_with_day(self, pool_type):
|