forked from mtusi2026/mtusi2026lab2
lab2: review round 2 — cache versioning, UUID normalization, cursor validation, benchmark evidence
This commit is contained in:
@@ -88,8 +88,8 @@ func (s *MessageService) List(ctx context.Context, callerID, chatID, cursor stri
|
||||
// Проверяем кэш. Если версия изменилась между GetVersion и Get — не используем.
|
||||
var versionBefore int64
|
||||
if s.cache != nil {
|
||||
versionBefore = s.cache.GetVersion(ctx, chatID)
|
||||
if items, next, hit := s.cache.Get(ctx, chatID, cursor, limit); hit {
|
||||
versionBefore = s.cache.GetVersion(ctx, chatID) // ← GetVersion не возвращает ошибку, ок
|
||||
if items, next, hit := s.cache.Get(ctx, chatID, cursor, limit); hit { // ← Get: при ошибке false
|
||||
// Проверяем, что версия не изменилась с момента Set
|
||||
if s.cache.GetVersion(ctx, chatID) == versionBefore {
|
||||
return items, next, nil
|
||||
|
||||
Reference in New Issue
Block a user