mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 00:33:12 +00:00
add peer cache support
This commit is contained in:
parent
8d773c4620
commit
50c7cd16d1
@ -1,5 +1,5 @@
|
||||
import { PeerId } from "@libp2p/interface";
|
||||
import { Libp2p } from "@waku/interfaces";
|
||||
import { Libp2p, Tags } from "@waku/interfaces";
|
||||
import { Logger } from "@waku/utils";
|
||||
|
||||
type BootstrapTriggerConstructorOptions = {
|
||||
@ -73,10 +73,10 @@ export class BootstrapTrigger implements IBootstrapTrigger {
|
||||
|
||||
const bootstrapComponents = Object.values(this.libp2p.components.components)
|
||||
.filter((c) => !!c)
|
||||
.filter(
|
||||
(c: unknown) =>
|
||||
(c as { [Symbol.toStringTag]: string })[Symbol.toStringTag] ===
|
||||
"@waku/bootstrap"
|
||||
.filter((c: unknown) =>
|
||||
[`@waku/${Tags.BOOTSTRAP}`, `@waku/${Tags.PEER_CACHE}`].includes(
|
||||
(c as { [Symbol.toStringTag]: string })?.[Symbol.toStringTag]
|
||||
)
|
||||
);
|
||||
|
||||
if (bootstrapComponents.length === 0) {
|
||||
@ -90,7 +90,8 @@ export class BootstrapTrigger implements IBootstrapTrigger {
|
||||
|
||||
bootstrapComponents.forEach((component) => {
|
||||
try {
|
||||
(component as { start: () => void }).start();
|
||||
(component as { stop: () => void })?.stop?.();
|
||||
(component as { start: () => void })?.start?.();
|
||||
log.info("Successfully started bootstrap component");
|
||||
} catch (error) {
|
||||
log.error("Failed to start bootstrap component", error);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user