Explorar el Código

tweak: 预曝光过滤默认 TTL 从 30min 缩短到 5min

PreViewedService.updateCache / updateSessionCache / resolveExpireMinutes
默认值统一 30 → 5 (含 2 处注释、1 处 javadoc、4 处兜底值)。

副作用: Apollo preview.exp.config 必须给 baseline 实验 (V566/V568) 显式
配 "30" 才能保持原行为, 否则会随默认掉到 5min, AB 对比失效。本地
apollo/preview.exp.config.json 已加 "566": 30 / "568": 30, 待运维同步推送。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
yangxiaohui hace 2 semanas
padre
commit
cba67aa062

+ 7 - 7
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/PreViewedService.java

@@ -57,7 +57,7 @@ public class PreViewedService {
                 || CollectionUtils.isEmpty(videos)) {
             return;
         }
-        // 1 更新预曝光数据 过期时间 30min
+        // 1 更新预曝光数据 过期时间 5min
         String[] videoIds = new String[videos.size()];
         for (int i = 0; i < videoIds.length; i++) {
             videoIds[i] = String.valueOf(videos.get(i).getVideoId());
@@ -73,17 +73,17 @@ public class PreViewedService {
     /**
      * 遍历 preview.exp.config(expCode → minutes),用 judgeHitAlgoExp 判断是否命中(算法层)。
      * judgeHitAlgoExp 同时覆盖 abExpCodes 通道和 root.session.id.exp.layer.config.算法 尾号通道。
-     * 都不命中 → 默认 30min。
+     * 都不命中 → 默认 5min。
      */
     private int resolveExpireMinutes(int appType, String rootSessionId, Set<String> abExpCodes) {
         if (MapUtils.isNotEmpty(preViewExpConfig)) {
             for (Map.Entry<String, Integer> entry : preViewExpConfig.entrySet()) {
                 if (experimentService.judgeHitAlgoExp(appType, rootSessionId, abExpCodes, entry.getKey())) {
-                    return entry.getValue() != null ? entry.getValue() : 30;
+                    return entry.getValue() != null ? entry.getValue() : 5;
                 }
             }
         }
-        return 30;
+        return 5;
     }
 
     public Set<Long> getVideoIds(int appType, String mid) {
@@ -108,20 +108,20 @@ public class PreViewedService {
                 || CollectionUtils.isEmpty(videos)) {
             return;
         }
-        // 1 更新预曝光数据 过期时间 30min
+        // 1 更新预曝光数据 过期时间 5min
         String[] videoIds = new String[videos.size()];
         for (int i = 0; i < videoIds.length; i++) {
             videoIds[i] = String.valueOf(videos.get(i).getVideoId());
         }
         String key = String.format(SESSION_PRE_VIEWED_FILTER_KEY, appType, mid, sessionId);
 
-        int expire = 30;
+        int expire = 5;
         if (MapUtils.isNotEmpty(preViewExpConfig)) {
             for (Map.Entry<String, Integer> entry : preViewExpConfig.entrySet()) {
                 if (CommonCollectionUtils.contains(abExpCodes, entry.getKey())) {
                     expire = entry.getValue() != null
                             ? entry.getValue()
-                            : 30;
+                            : 5;
                     break;
                 }
             }