mirror of https://github.com/waku-org/js-waku.git
feat: create a monitor per subscription
This commit is contained in:
parent
777f497d13
commit
b95436576e
|
@ -27,6 +27,7 @@ import {
|
|||
} from "@waku/utils";
|
||||
|
||||
import { BaseProtocolSDK } from "../base_protocol";
|
||||
import { MessageReliabilityMonitor } from "../message_reliability_monitor";
|
||||
|
||||
import { SubscriptionManager } from "./subscription_manager";
|
||||
|
||||
|
@ -203,9 +204,9 @@ class FilterSDK extends BaseProtocolSDK implements IFilterSDK {
|
|||
this.connectedPeers.map((peer) => peer.id.toString())
|
||||
);
|
||||
|
||||
const subscription =
|
||||
this.getActiveSubscription(pubsubTopic) ??
|
||||
this.setActiveSubscription(
|
||||
let subscription = this.getActiveSubscription(pubsubTopic);
|
||||
if (!subscription) {
|
||||
subscription = this.setActiveSubscription(
|
||||
pubsubTopic,
|
||||
new SubscriptionManager(
|
||||
pubsubTopic,
|
||||
|
@ -216,6 +217,9 @@ class FilterSDK extends BaseProtocolSDK implements IFilterSDK {
|
|||
)
|
||||
);
|
||||
|
||||
new MessageReliabilityMonitor(this, subscription);
|
||||
}
|
||||
|
||||
return {
|
||||
error: null,
|
||||
subscription
|
||||
|
|
|
@ -18,7 +18,7 @@ import { Logger } from "@waku/utils";
|
|||
|
||||
import { wakuFilter } from "./protocols/filter/index.js";
|
||||
import { wakuLightPush } from "./protocols/light_push.js";
|
||||
import { MessageReliabilityMonitor } from "./protocols/message_reliability_monitor.js";
|
||||
import { MessageReliabilityManager } from "./protocols/message_reliability_monitor.js";
|
||||
import { wakuStore } from "./protocols/store.js";
|
||||
|
||||
export const DefaultPingKeepAliveValueSecs = 5 * 60;
|
||||
|
@ -116,7 +116,7 @@ export class WakuNode implements Waku {
|
|||
if (protocolsEnabled.filter) {
|
||||
const filter = wakuFilter(this.connectionManager);
|
||||
this.filter = filter(libp2p);
|
||||
new MessageReliabilityMonitor(this.filter);
|
||||
new MessageReliabilityManager(this.filter);
|
||||
}
|
||||
|
||||
log.info(
|
||||
|
|
Loading…
Reference in New Issue