Skip to content

Commit

Permalink
feat(filter): reliability monitor as a separate class to handle relia…
Browse files Browse the repository at this point in the history
…bility logic (#2117)

* chore: move SubscriptionManager to a separate file

* feat: introduce ReliabilityMonitor

* fix: peer data updates

* fix: logical error when returning includesMessage

* chore: handle edge case

* chore: move ping failures handling inside monitor

* chore: move renewal logic to monitor

* chore: improve structuring

* chore: update logger

* chore: readd connectionListener() logic from merge

* chore: minor fixes

* chore: improve

* chore: setup destruction of ReliabilityMonitors

* fix: condition for ping failure

* fix: setters

* chore: handle race condition & fix test
  • Loading branch information
danisharora099 authored Sep 13, 2024
1 parent 9d9a696 commit 7ad1d32
Show file tree
Hide file tree
Showing 10 changed files with 925 additions and 767 deletions.
5 changes: 5 additions & 0 deletions packages/interfaces/src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import type {
} from "./protocols.js";
import type { IReceiver } from "./receiver.js";

export type SubscriptionCallback<T extends IDecodedMessage> = {
decoders: IDecoder<T>[];
callback: Callback<T>;
};

export type SubscribeOptions = {
keepAlive?: number;
pingsBeforePeerRenewed?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export {
createLibp2pAndUpdateOptions
} from "./create/index.js";
export { wakuLightPush } from "./protocols/light_push.js";
export { wakuFilter } from "./protocols/filter.js";
export { wakuFilter } from "./protocols/filter/index.js";
export { wakuStore } from "./protocols/store.js";

export * as waku from "@waku/core";
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/protocols/base_protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class BaseProtocolSDK implements IBaseProtocolSDK {

public constructor(
protected core: BaseProtocol,
private connectionManager: ConnectionManager,
protected connectionManager: ConnectionManager,
options: Options
) {
this.log = new Logger(`sdk:${core.multicodec}`);
Expand Down
Loading

0 comments on commit 7ad1d32

Please sign in to comment.