Skip to content

Commit df36ab5

Browse files
joeltgraykyri
authored andcommitted
packages/core: use app topic directly to get subscribers
1 parent 15938e9 commit df36ab5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/core/src/Canvas.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type { ServiceMap } from "./targets/interface.js"
1919
import { Runtime, createRuntime } from "./runtime/index.js"
2020
import { validatePayload } from "./schema.js"
2121
import { assert } from "./utils.js"
22+
import { GossipLogService } from "@canvas-js/gossiplog/service"
2223

2324
export interface NetworkConfig {
2425
offline?: boolean
@@ -201,9 +202,7 @@ export class Canvas<T extends Contract = Contract> extends EventEmitter<CanvasEv
201202

202203
const startPingTimer = () => {
203204
this.pingTimer = setInterval(() => {
204-
// topic is canvas/{app.topic}
205-
const topics = this.libp2p.services.pubsub.getTopics()
206-
const subscribers = this.libp2p.services.pubsub.getSubscribers(topics[0])
205+
const subscribers = this.libp2p.services.pubsub.getSubscribers(GossipLogService.topicPrefix + this.topic)
207206
const pings = this.peers.map((peer) =>
208207
this.libp2p.services.ping
209208
.ping(peer)

0 commit comments

Comments
 (0)