From 29a6c1579db1d1d38a774adfae145234a8907e36 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 19 Jan 2023 16:03:04 -0400 Subject: [PATCH] fix: empty responses should not generate an error --- waku/v2/protocol/store/waku_store_client.go | 7 ++++--- waku/v2/protocol/store/waku_store_common.go | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/waku/v2/protocol/store/waku_store_client.go b/waku/v2/protocol/store/waku_store_client.go index ab450c9b..527e5f21 100644 --- a/waku/v2/protocol/store/waku_store_client.go +++ b/waku/v2/protocol/store/waku_store_client.go @@ -206,9 +206,10 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec } if historyResponseRPC.Response == nil { - logger.Error("empty response") - metrics.RecordStoreError(store.ctx, "emptyRpcResponseFailure") - return nil, ErrEmptyResponse + // Empty response + return &pb.HistoryResponse{ + PagingInfo: &pb.PagingInfo{}, + }, nil } metrics.RecordMessage(ctx, "retrieved", len(historyResponseRPC.Response.Messages)) diff --git a/waku/v2/protocol/store/waku_store_common.go b/waku/v2/protocol/store/waku_store_common.go index 3aaf6246..f4bed7cf 100644 --- a/waku/v2/protocol/store/waku_store_common.go +++ b/waku/v2/protocol/store/waku_store_common.go @@ -41,8 +41,6 @@ var ( ErrFailedQuery = errors.New("failed to resolve the query") ErrFutureMessage = errors.New("message timestamp in the future") - - ErrEmptyResponse = errors.New("empty store response") ) type WakuSwap interface {