diff --git a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/lucky/Lucky24UserMetaService.java b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/lucky/Lucky24UserMetaService.java index 191f0c6cb..ff21f6ab6 100644 --- a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/lucky/Lucky24UserMetaService.java +++ b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/lucky/Lucky24UserMetaService.java @@ -184,6 +184,10 @@ public class Lucky24UserMetaService { String today = String.valueOf(todayStartTimeLong); String todayTimesKey = String.join("_", today, TIMES_KEY); long todayTimes = userMetaMap.addAndGet(todayTimesKey, 1L).longValue(); + String todayInputKey = String.join("_", today, INPUT_KEY); + long todayInput = userMetaMap.addAndGet(todayInputKey, input).longValue(); + String todayOutputKey = String.join("_", today, OUTPUT_KEY); + long todayOutput = userMetaMap.addAndGet(todayOutputKey, output).longValue(); long userMetaToday = userMetaMap.computeIfAbsent(TODAY, k->todayStartTimeLong).longValue(); if (userMetaToday < todayStartTimeLong @@ -197,7 +201,7 @@ public class Lucky24UserMetaService { String oldTodayOutputKey = String.join("_", oldToday, OUTPUT_KEY); String oldTodayExtraPoolKey = String.join("_", oldToday, EXTRA_POOL_COUNT); - int oneDayAgoDiff = 2 * 24 * 60 * 60 * 1000; + int oneDayAgoDiff = 24 * 60 * 60 * 1000; if (userMetaToday >= todayStartTimeLong - 2 * oneDayAgoDiff){ String oldDayInputKey = String.join("_", INPUT_KEY, oldToday); @@ -211,7 +215,8 @@ public class Lucky24UserMetaService { Set needDeleteKeySet = new HashSet<>(); for (String key : userMetaMapSnapshot.keySet()){ - if (key.startsWith(INPUT_KEY) || key.startsWith(OUTPUT_KEY)){ + if ((key.startsWith(INPUT_KEY) && !key.equals(INPUT_KEY)) + || (key.startsWith(OUTPUT_KEY) && !key.equals(OUTPUT_KEY))){ if (key.endsWith(TWO_DAY_AGO)){ continue; } @@ -255,8 +260,8 @@ public class Lucky24UserMetaService { } } - log.info("[Lucky24] updateUserMeta uid {} times {} today {} todayTimes {}", - senderUid, times, todayStartTimeLong, todayTimes); + log.info("[Lucky24] updateUserMeta uid {} times {} todayInput {} todayOutput {} today {} todayTimes {} todayIntput {} todayOutput {}", + senderUid, times, totalInput, totalOutput, todayStartTimeLong, todayTimes, todayInput, todayOutput); } public RMap getUserMeta(Long uid) {