处理一些合并冲突
This commit is contained in:
+2
-35
@@ -341,7 +341,8 @@ public class ZiniaoShopIndexService {
|
||||
cursor.setMessage(ex.getMessage());
|
||||
cursor.setLastFinishedAt(now);
|
||||
if (isIpWhitelistRefreshFailure(ex)) {
|
||||
markExistingEntriesRefreshBlocked(now, REFRESH_BLOCKED_REASON_IP_WHITELIST, ex.getMessage());
|
||||
log.warn("[ziniao-index] refresh blocked reason={} existing shop index rows left untouched",
|
||||
REFRESH_BLOCKED_REASON_IP_WHITELIST);
|
||||
}
|
||||
ziniaoTransientCacheService.put(CACHE_TYPE_SHOP_INDEX_REFRESH_CURSOR, "global", cursor, DEFAULT_CURSOR_TTL);
|
||||
log.warn("[ziniao-index] refresh failed status=FAILED msg={}", ex.getMessage());
|
||||
@@ -589,40 +590,6 @@ public class ZiniaoShopIndexService {
|
||||
return message != null && message.contains("白名单");
|
||||
}
|
||||
|
||||
private void markExistingEntriesRefreshBlocked(long now, String reason, String message) {
|
||||
List<ZiniaoMemoryStoreEntity> entities = ziniaoMemoryStoreService.listAliveEntitiesByType(
|
||||
ZiniaoMemoryStoreService.CACHE_TYPE_SHOP_INDEX_ENTRY,
|
||||
SHOP_INDEX_LIST_LIMIT
|
||||
);
|
||||
if (entities.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
int updated = 0;
|
||||
for (ZiniaoMemoryStoreEntity entity : entities) {
|
||||
String rowKey = entity.getCacheKey();
|
||||
ZiniaoShopIndexEntryDto existingEntry;
|
||||
try {
|
||||
existingEntry = objectMapper.readValue(entity.getPayloadJson(), ZiniaoShopIndexEntryDto.class);
|
||||
} catch (Exception ex) {
|
||||
log.warn("[ziniao-index] skip refresh-block mark corrupt shop_index row cacheKey={}", rowKey);
|
||||
continue;
|
||||
}
|
||||
if (existingEntry == null || !STATUS_ACTIVE.equals(existingEntry.getStatus())) {
|
||||
continue;
|
||||
}
|
||||
existingEntry.setLastRefreshBlockedAt(now);
|
||||
existingEntry.setRefreshBlockedReason(reason);
|
||||
if (message != null && !message.isBlank()) {
|
||||
existingEntry.setMessage(message);
|
||||
}
|
||||
ziniaoMemoryStoreService.put(ZiniaoMemoryStoreService.CACHE_TYPE_SHOP_INDEX_ENTRY, rowKey, existingEntry, resolveEntryTtl());
|
||||
updated++;
|
||||
}
|
||||
if (updated > 0) {
|
||||
log.warn("[ziniao-index] refresh blocked reason={} existing active rows kept usable count={}", reason, updated);
|
||||
}
|
||||
}
|
||||
|
||||
private Duration resolveEntryTtl() {
|
||||
Integer ttlHours = ziniaoProperties.getShopIndexEntryTtlHours();
|
||||
if (ttlHours == null || ttlHours <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user