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