refactor_: missing_messages.go rename missingMessages field to missingHashes

This commit is contained in:
Ivan Folgueira Bande 2024-07-01 09:55:11 +02:00 committed by Andrea Maria Piana
parent 11fcec2109
commit cbcc3ab3a8
1 changed files with 4 additions and 4 deletions

View File

@ -201,7 +201,7 @@ func (w *Waku) fetchMessagesBatch(missingHistoryRequest TopicInterest, batchFrom
return err return err
} }
var missingMessages []pb.MessageHash var missingHashes []pb.MessageHash
for !result.IsComplete() { for !result.IsComplete() {
for _, mkv := range result.Messages() { for _, mkv := range result.Messages() {
@ -214,7 +214,7 @@ func (w *Waku) fetchMessagesBatch(missingHistoryRequest TopicInterest, batchFrom
continue continue
} }
missingMessages = append(missingMessages, hash) missingHashes = append(missingHashes, hash)
} }
result, err = w.storeQueryWithRetry(missingHistoryRequest.ctx, func(ctx context.Context) (*store.Result, error) { result, err = w.storeQueryWithRetry(missingHistoryRequest.ctx, func(ctx context.Context) (*store.Result, error) {
@ -231,13 +231,13 @@ func (w *Waku) fetchMessagesBatch(missingHistoryRequest TopicInterest, batchFrom
} }
} }
if len(missingMessages) == 0 { if len(missingHashes) == 0 {
// Nothing to do here // Nothing to do here
return nil return nil
} }
result, err = w.storeQueryWithRetry(missingHistoryRequest.ctx, func(ctx context.Context) (*store.Result, error) { result, err = w.storeQueryWithRetry(missingHistoryRequest.ctx, func(ctx context.Context) (*store.Result, error) {
return w.node.Store().QueryByHash(ctx, missingMessages, store.WithPeer(missingHistoryRequest.peerID), store.WithPaging(false, 100)) return w.node.Store().QueryByHash(ctx, missingHashes, store.WithPeer(missingHistoryRequest.peerID), store.WithPaging(false, 100))
}, logger, "retrieving missing messages") }, logger, "retrieving missing messages")
if err != nil { if err != nil {
if !errors.Is(err, context.Canceled) { if !errors.Is(err, context.Canceled) {