Skip to content

Commit d036fe8

Browse files
committed
update
1 parent 07849aa commit d036fe8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bridge-history-api/internal/logic/history_logic.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pa
368368
return nil, 0, false, err
369369
}
370370

371+
if start > total {
372+
return nil, 0, false, nil
373+
}
374+
371375
if total == 0 {
372376
return nil, 0, false, nil
373377
}
@@ -440,11 +444,16 @@ func (h *HistoryLogic) processAndCacheTxHistoryInfo(ctx context.Context, cacheKe
440444
return nil, 0, err
441445
}
442446

443-
pagedTxs, total, _, err := h.getCachedTxsInfo(ctx, cacheKey, page, pageSize)
447+
pagedTxs, total, isHit, err := h.getCachedTxsInfo(ctx, cacheKey, page, pageSize)
444448
if err != nil {
445449
log.Error("failed to get cached tx info", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err)
446450
return nil, 0, err
447451
}
448452

453+
if !isHit {
454+
log.Error("cache miss after write, expect hit", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err)
455+
return nil, 0, err
456+
}
457+
449458
return pagedTxs, total, nil
450459
}

0 commit comments

Comments
 (0)