Skip to content

Commit

Permalink
chore: validating messages should be non-blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jul 17, 2024
1 parent f766e31 commit 128dd58
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/sdk/src/protocols/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import { ConnectionManager, FilterCore } from "@waku/core";
import {
type Callback,
type ContentTopic,
CoreProtocolResult,
CreateSubscriptionResult,
type CoreProtocolResult,
type CreateSubscriptionResult,
type IAsyncIterator,
type IDecodedMessage,
type IDecoder,
type IFilterSDK,
type IProtoMessage,
type ISubscriptionSDK,
type Libp2p,
PeerIdStr,
type PeerIdStr,
type ProtocolCreateOptions,
ProtocolError,
ProtocolUseOptions,
type ProtocolUseOptions,
type PubsubTopic,
SDKProtocolResult,
type SDKProtocolResult,
type ShardingParams,
SubscribeOptions,
type SubscribeOptions,
type Unsubscribe
} from "@waku/interfaces";
import { messageHashStr } from "@waku/message-hash";
Expand Down Expand Up @@ -93,7 +93,7 @@ export class SubscriptionManager implements ISubscriptionSDK {
return [...this.receivedMessagesHashes.all];
}

addHash(hash: string, peerIdStr?: string): void {
private addHash(hash: string, peerIdStr?: string): void {
this.receivedMessagesHashes.all.add(hash);

if (peerIdStr) {
Expand Down Expand Up @@ -259,7 +259,7 @@ export class SubscriptionManager implements ISubscriptionSDK {
);

this.addHash(hashedMessageStr, peerIdStr);
await this.validateMessage();
void this.validateMessage();

if (this.receivedMessagesHashStr.includes(hashedMessageStr)) {
log.info("Message already received, skipping");
Expand Down

0 comments on commit 128dd58

Please sign in to comment.