From 07849aa40153077a4c9e998609be1f315ae6020f Mon Sep 17 00:00:00 2001 From: georgehao Date: Tue, 25 Nov 2025 23:04:41 +0800 Subject: [PATCH 1/4] remove the check --- bridge-history-api/internal/logic/history_logic.go | 6 +----- common/version/version.go | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bridge-history-api/internal/logic/history_logic.go b/bridge-history-api/internal/logic/history_logic.go index ee52ce3ac5..7559a74be5 100644 --- a/bridge-history-api/internal/logic/history_logic.go +++ b/bridge-history-api/internal/logic/history_logic.go @@ -440,15 +440,11 @@ func (h *HistoryLogic) processAndCacheTxHistoryInfo(ctx context.Context, cacheKe return nil, 0, err } - pagedTxs, total, isHit, err := h.getCachedTxsInfo(ctx, cacheKey, page, pageSize) + pagedTxs, total, _, err := h.getCachedTxsInfo(ctx, cacheKey, page, pageSize) if err != nil { log.Error("failed to get cached tx info", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err) return nil, 0, err } - if !isHit { - log.Error("cache miss after write, expect hit", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err) - return nil, 0, err - } return pagedTxs, total, nil } diff --git a/common/version/version.go b/common/version/version.go index 9c81caa1bf..6418ac17b7 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.7.4" +var tag = "v4.7.5" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { From d036fe8b83538c6bddf769896f3dd736ed579199 Mon Sep 17 00:00:00 2001 From: georgehao Date: Tue, 25 Nov 2025 23:13:15 +0800 Subject: [PATCH 2/4] update --- bridge-history-api/internal/logic/history_logic.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bridge-history-api/internal/logic/history_logic.go b/bridge-history-api/internal/logic/history_logic.go index 7559a74be5..c7fde0c18f 100644 --- a/bridge-history-api/internal/logic/history_logic.go +++ b/bridge-history-api/internal/logic/history_logic.go @@ -368,6 +368,10 @@ func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pa return nil, 0, false, err } + if start > total { + return nil, 0, false, nil + } + if total == 0 { return nil, 0, false, nil } @@ -440,11 +444,16 @@ func (h *HistoryLogic) processAndCacheTxHistoryInfo(ctx context.Context, cacheKe return nil, 0, err } - pagedTxs, total, _, err := h.getCachedTxsInfo(ctx, cacheKey, page, pageSize) + pagedTxs, total, isHit, err := h.getCachedTxsInfo(ctx, cacheKey, page, pageSize) if err != nil { log.Error("failed to get cached tx info", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err) return nil, 0, err } + if !isHit { + log.Error("cache miss after write, expect hit", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err) + return nil, 0, err + } + return pagedTxs, total, nil } From 8122cb87187a4f62b90031280c611fb9fc4204da Mon Sep 17 00:00:00 2001 From: georgehao Date: Tue, 25 Nov 2025 23:18:57 +0800 Subject: [PATCH 3/4] update --- bridge-history-api/internal/logic/history_logic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge-history-api/internal/logic/history_logic.go b/bridge-history-api/internal/logic/history_logic.go index c7fde0c18f..32beb3bc9f 100644 --- a/bridge-history-api/internal/logic/history_logic.go +++ b/bridge-history-api/internal/logic/history_logic.go @@ -368,7 +368,7 @@ func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pa return nil, 0, false, err } - if start > total { + if start >= total { return nil, 0, false, nil } From daa0e26bd38d6f4e2715cb904d4fc90ac4769daa Mon Sep 17 00:00:00 2001 From: georgehao Date: Tue, 25 Nov 2025 23:21:39 +0800 Subject: [PATCH 4/4] update --- bridge-history-api/internal/logic/history_logic.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bridge-history-api/internal/logic/history_logic.go b/bridge-history-api/internal/logic/history_logic.go index 32beb3bc9f..e16f382f37 100644 --- a/bridge-history-api/internal/logic/history_logic.go +++ b/bridge-history-api/internal/logic/history_logic.go @@ -361,18 +361,17 @@ func getTxHistoryInfoFromBridgeBatchDepositMessage(message *orm.BridgeBatchDepos func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pageNum, pageSize uint64) ([]*types.TxHistoryInfo, uint64, bool, error) { start := int64((pageNum - 1) * pageSize) end := start + int64(pageSize) - 1 - total, err := h.redis.ZCard(ctx, cacheKey).Result() if err != nil { log.Error("failed to get zcard result", "error", err) return nil, 0, false, err } - if start >= total { + if total == 0 { return nil, 0, false, nil } - if total == 0 { + if start >= total { return nil, 0, false, nil }