|
@@ -221,15 +221,25 @@ public abstract class RankStrategyBasic implements RankStrategy {
|
|
|
|
|
|
|
|
// 等待所有任务完成并合并结果
|
|
// 等待所有任务完成并合并结果
|
|
|
for (Future<Feature> future : futures) {
|
|
for (Future<Feature> future : futures) {
|
|
|
- Feature batchFeature = future.get(); // 获取每个任务的结果
|
|
|
|
|
- if (finalFeature == null) {
|
|
|
|
|
- finalFeature = batchFeature;
|
|
|
|
|
- } else {
|
|
|
|
|
- // 合并特征
|
|
|
|
|
- finalFeature.merge(batchFeature);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ Feature batchFeature = future.get(); // 获取每个任务的结果
|
|
|
|
|
+ if (batchFeature != null) {
|
|
|
|
|
+ if (finalFeature == null) {
|
|
|
|
|
+ finalFeature = batchFeature;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 合并特征
|
|
|
|
|
+ finalFeature.merge(batchFeature);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (ExecutionException e) {
|
|
|
|
|
+ log.error("获取特征批次失败: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
|
|
|
|
|
+ // 继续处理其他批次,不中断整个流程
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } catch (InterruptedException | ExecutionException e) {
|
|
|
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
|
+ log.error("getFeature interrupted", e);
|
|
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("getFeature error", e);
|
|
log.error("getFeature error", e);
|
|
|
}
|
|
}
|
|
|
log.info("getFeature time: {}", System.currentTimeMillis() - startTime);
|
|
log.info("getFeature time: {}", System.currentTimeMillis() - startTime);
|
|
@@ -915,6 +925,13 @@ public abstract class RankStrategyBasic implements RankStrategy {
|
|
|
|
|
|
|
|
protected void putMetaFeature(AdRankItem adRankItem, Feature feature, Map<String, String> reqFeature,
|
|
protected void putMetaFeature(AdRankItem adRankItem, Feature feature, Map<String, String> reqFeature,
|
|
|
Map<String, String> sceneFeatureMap, RankRecommendRequestParam request) {
|
|
Map<String, String> sceneFeatureMap, RankRecommendRequestParam request) {
|
|
|
|
|
+ if (feature == null) {
|
|
|
|
|
+ log.warn("putMetaFeature: feature is null, skip processing. adVerId={}", adRankItem.getAdVerId());
|
|
|
|
|
+ adRankItem.getMetaFeatureMap().put("reqFeature", reqFeature);
|
|
|
|
|
+ adRankItem.getMetaFeatureMap().put("sceneFeature", sceneFeatureMap);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Map<String, Map<String, String>> userFeature = feature.getUserFeature();
|
|
Map<String, Map<String, String>> userFeature = feature.getUserFeature();
|
|
|
Map<String, Map<String, String>> videoFeature = feature.getVideoFeature();
|
|
Map<String, Map<String, String>> videoFeature = feature.getVideoFeature();
|
|
|
Map<String, Map<String, Map<String, String>>> allAdVerFeature = feature.getAdVerFeature();
|
|
Map<String, Map<String, Map<String, String>>> allAdVerFeature = feature.getAdVerFeature();
|