fix: add stop() to IRelayAPI and IStore interfaces, implement in SDK wrappers

This commit is contained in:
Levente Kiss 2025-10-31 19:09:27 +13:00 committed by fryorcraken
parent a97e7eceb9
commit dd1977455d
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ export interface IRelayAPI {
readonly pubsubTopics: Set<PubsubTopic>; readonly pubsubTopics: Set<PubsubTopic>;
readonly gossipSub: GossipSub; readonly gossipSub: GossipSub;
start: () => Promise<void>; start: () => Promise<void>;
stop: () => Promise<void>;
waitForPeers: () => Promise<void>; waitForPeers: () => Promise<void>;
getMeshPeers: (topic?: TopicStr) => PeerIdStr[]; getMeshPeers: (topic?: TopicStr) => PeerIdStr[];
} }

View File

@ -99,6 +99,7 @@ export type QueryRequestParams = {
export type IStore = { export type IStore = {
readonly multicodec: string; readonly multicodec: string;
stop(): void;
createCursor(message: IDecodedMessage): StoreCursor; createCursor(message: IDecodedMessage): StoreCursor;
queryGenerator: <T extends IDecodedMessage>( queryGenerator: <T extends IDecodedMessage>(
decoders: IDecoder<T>[], decoders: IDecoder<T>[],

View File

@ -65,6 +65,7 @@ export class LightPush implements ILightPush {
public stop(): void { public stop(): void {
this.retryManager.stop(); this.retryManager.stop();
this.protocol.stop();
} }
public async send( public async send(

View File

@ -46,6 +46,10 @@ export class Store implements IStore {
return this.protocol.multicodec; return this.protocol.multicodec;
} }
public stop(): void {
this.protocol.stop();
}
/** /**
* Queries the Waku Store for historical messages using the provided decoders and options. * Queries the Waku Store for historical messages using the provided decoders and options.
* Returns an asynchronous generator that yields promises of decoded messages. * Returns an asynchronous generator that yields promises of decoded messages.