|
@@ -1,4 +1,5 @@
|
|
|
package com.tzld.piaoquan.recommend.server.service.recall;
|
|
|
+
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.piaoquan.recommend.server.common.ThreadPoolFactory;
|
|
|
import com.tzld.piaoquan.recommend.server.common.base.Constant;
|
|
@@ -59,19 +60,20 @@ public class RecallService implements ApplicationContextAware {
|
|
|
|
|
|
public RecallResult recall(RecallParam param) {
|
|
|
List<RecallStrategy> strategies = getRecallStrategy(param);
|
|
|
- log.info("strategies {}", JSONUtils.toJson(CommonCollectionUtils.toList(strategies, o -> o.getClass().getSimpleName())));
|
|
|
+// log.info("strategies {}", JSONUtils.toJson(CommonCollectionUtils.toList(strategies,
|
|
|
+// o -> o.getClass().getSimpleName())));
|
|
|
CountDownLatch cdl = new CountDownLatch(strategies.size());
|
|
|
List<Future<RecallResult.RecallData>> recallResultFutures = new ArrayList<>();
|
|
|
for (final RecallStrategy strategy : strategies) {
|
|
|
Future<RecallResult.RecallData> future = pool.submit(() -> {
|
|
|
+ List<Video> result = Collections.emptyList();
|
|
|
try {
|
|
|
- List<Video> result = strategy.recall(param);
|
|
|
- cdl.countDown();
|
|
|
- return new RecallResult.RecallData(strategy.pushFrom(), result);
|
|
|
+ result = strategy.recall(param);
|
|
|
} catch (Throwable e) {
|
|
|
log.error("recall error {}", strategy.getClass().getSimpleName(), e);
|
|
|
}
|
|
|
- return new RecallResult.RecallData(strategy.pushFrom(), Collections.emptyList());
|
|
|
+ cdl.countDown();
|
|
|
+ return new RecallResult.RecallData(strategy.pushFrom(), result);
|
|
|
});
|
|
|
recallResultFutures.add(future);
|
|
|
}
|
|
@@ -102,9 +104,9 @@ public class RecallService implements ApplicationContextAware {
|
|
|
return strategies;
|
|
|
}
|
|
|
|
|
|
- String matchUserBlacklistTypeEnum = blacklistContainer.matchUserBlacklistTypeEnum(param.getUid(), param.getHotSceneType(), param.getCityCode(),
|
|
|
- param.getClientIp(), param.getMid(), "recommend-flow-pool", param.getAppType());
|
|
|
- boolean hitUserBlacklist = StringUtils.isNotBlank(matchUserBlacklistTypeEnum);
|
|
|
+ String matchUserBlacklistTypeEnum = blacklistContainer.matchUserBlacklistTypeEnum(param.getUid(), param.getHotSceneType(), param.getCityCode(),
|
|
|
+ param.getClientIp(), param.getMid(), "recommend-flow-pool", param.getAppType());
|
|
|
+ boolean hitUserBlacklist = StringUtils.isNotBlank(matchUserBlacklistTypeEnum);
|
|
|
boolean isInBlacklist = CollectionUtils.isNotEmpty(blacklistAppTypeSet) && blacklistAppTypeSet.contains(param.getAppType());
|
|
|
|
|
|
String abCode = param.getAbCode();
|
|
@@ -369,13 +371,13 @@ public class RecallService implements ApplicationContextAware {
|
|
|
this.applicationContext = applicationContext;
|
|
|
}
|
|
|
|
|
|
- private boolean matchSpecialApp(int appId){
|
|
|
+ private boolean matchSpecialApp(int appId) {
|
|
|
Set<Integer> notSpecialApp = new HashSet<>(Arrays.asList(0, 4, 5));
|
|
|
- if (notSpecialApp.contains(appId)){
|
|
|
+ if (notSpecialApp.contains(appId)) {
|
|
|
// vlog 票圈视频 内容精选 不允许走特殊列表,即使配置了也无效。
|
|
|
return false;
|
|
|
}
|
|
|
- if (specialAppVid != null && specialAppVid.getOrDefault("app", new ArrayList<>()).contains((long) appId)){
|
|
|
+ if (specialAppVid != null && specialAppVid.getOrDefault("app", new ArrayList<>()).contains((long) appId)) {
|
|
|
log.info("This request hits a special logic in matchSpecialApp with appId={}", appId);
|
|
|
return true;
|
|
|
}
|